STM32F401CCU Black Pill not detected by Win 7

Post here first, or if you can't find a relevant section!
Post Reply
warjon
Posts: 5
Joined: Tue Nov 21, 2023 11:04 pm

STM32F401CCU Black Pill not detected by Win 7

Post by warjon »

I am in the process of designing an FOC controller for a PMS motor. Using the STM32F401CCU Black Pill.

The environment is as follows
Windows 7 PC
Arduino IDE V 1.8.19
SimpleFOC driver V 2.0.4

I tried uploading pics here but by the time I resized them they were eligible, so I uploaded them in this link on my blog

https://warrensaudio.blogspot.com/p/uploaded-pics.html

The first time the STM32 was plugged into the PC Win detected it and it was visible in Device Manager. I then loaded the Virtual Com Port driver and Win assigned the STM32 COM9.

Next I disconnected the USB and used the STLink to load the script which worked and the code runs correctly. The code uses the Serial Terminal to adjust motor parameters for tuning, so I need a COM port assigned to the STM32.

I removed the STLink and plugged the STM32 into the PC via the same USB port and NOTHING Windows does not even see the device. No ding donk and nothing in Device Manager.

hopefully some of the brains trust can shed some light on what I need to do to rectify this problem, thanks Warren
ag123
Posts: 1653
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: STM32F401CCU Black Pill not detected by Win 7

Post by ag123 »

well. you need to mention which core you are using.
The 'official' STM core is here
https://github.com/stm32duino/Arduino_Core_STM32
and wiki here
https://github.com/stm32duino/Arduino_Core_STM32/wiki
install instruction is here
https://github.com/stm32duino/Arduino_C ... ng-Started
and you need to select "USB (CDC) Serial" from the menu when you build the sketch.
In addition, test with a sketch like

Code: Select all

void setup() {
	while(!Serial); // wait for USB serial to connect
	Serial.begin();
	Serial.println("hello world");
}

void loop() {
	/* echo inputs back to serial monitor */
	while(Serial.available()) {
		int c = Serial.read();
		Serial.write(c);
	}
	delay(1);
	// or wait for systick interrupt
	// asm("wfi");
}
warjon
Posts: 5
Joined: Tue Nov 21, 2023 11:04 pm

Re: STM32F401CCU Black Pill not detected by Win 7

Post by warjon »

Maybe I have asked this question in the wrong forum as this is a Windows driver issue not an Arduino IDE issue. I have no problem loading sketches to the STM32

I have loaded the STM32 in Board Manager and it uses the STM32F401CC. I can compile and load sketches to the STM32.

The issue is I have is no serial monitor without WINDOWS assigning a COM port and Windows is not detecting the STM32. Windows does detect the STlink.
Untitled.jpg
Untitled.jpg (62.98 KiB) Viewed 7441 times
User avatar
fpiSTM
Posts: 1723
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: STM32F401CCU Black Pill not detected by Win 7

Post by fpiSTM »

ag123
Posts: 1653
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: STM32F401CCU Black Pill not detected by Win 7

Post by ag123 »

in linux, there is something called
https://github.com/jkulesza/usbreset
what that does is to get the usb host controller to issue 'usb reset' (single ended zero) and enumerate (all) devices again.
that normally works the same if you disconnect and reconnect your device, or perhaps try pressing reset on the pill board.

In windows to do that 'usb reset', you can try to disable and enable the device in device manager, it probably has the same effect.

But the key is USB (CDC) serial needs to be built into the sketch/firmware, so that it'd present as a usb (CDC) comm device on reset, connect.
In some cases, you need at least a reset on the pill board so that usb would enumerate and you can see the 'com:' port.

oh and for the *board part number* it should normally be "BlackPill F401CC"
USB requires it to be running on HSE the 12mhz external crystal and that usb pheriperial needs to be clocked at exactly/precisely 48 Mhz.
If you do not know how to do that, select the correct board part number which sets up the clocks correctly.
For that if you are using a custom board, you need to create a new variant and setup HSE clocks in SystemClock_Config(void)
https://github.com/stm32duino/Arduino_C ... figuration
warjon
Posts: 5
Joined: Tue Nov 21, 2023 11:04 pm

Re: STM32F401CCU Black Pill not detected by Win 7

Post by warjon »

fpiSTM wrote: Wed Nov 22, 2023 8:17 am You can try to install this:
https://www.st.com/en/development-tools ... nk009.html
Thanks I downloaded this and installed it. Made no difference I still have no COM port assigned to the STM32 in Device Manager. I should have noted STM32 Cube Programmer is installed.

This is with the STLink plugged in
STM32-1.jpg
STM32-1.jpg (86.14 KiB) Viewed 7349 times
This is with the STM32 onboard USB plugged in and the STM32 put into DFU Bootloader mode. If I take it out of bootloader mode by pressing reset the device disappears completely from Device Manager.
STM32-2.jpg
STM32-2.jpg (87.9 KiB) Viewed 7349 times
ag123
Posts: 1653
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: STM32F401CCU Black Pill not detected by Win 7

Post by ag123 »

warjon wrote: Thu Nov 23, 2023 12:52 am
fpiSTM wrote: Wed Nov 22, 2023 8:17 am You can try to install this:
https://www.st.com/en/development-tools ... nk009.html
Thanks I downloaded this and installed it. Made no difference I still have no COM port assigned to the STM32 in Device Manager. I should have noted STM32 Cube Programmer is installed.

This is with the STLink plugged in
as mentioned the *board part number* it should normally be "BlackPill F401CC", otherwise update the codes in SystemClock_Config(void) for your board variant to make sure that it is running properly on HSE external crystal and that usb peripheral is clocked at 48 Mhz
to determine the PLL multipliers you can try this utility
viewtopic.php?t=78
warjon
Posts: 5
Joined: Tue Nov 21, 2023 11:04 pm

Re: STM32F401CCU Black Pill not detected by Win 7

Post by warjon »

ag123 wrote: Thu Nov 23, 2023 3:43 am
warjon wrote: Thu Nov 23, 2023 12:52 am
fpiSTM wrote: Wed Nov 22, 2023 8:17 am You can try to install this:
https://www.st.com/en/development-tools ... nk009.html
Thanks I downloaded this and installed it. Made no difference I still have no COM port assigned to the STM32 in Device Manager. I should have noted STM32 Cube Programmer is installed.

This is with the STLink plugged in
as mentioned the *board part number* it should normally be "BlackPill F401CC", otherwise update the codes in SystemClock_Config(void) for your board variant to make sure that it is running properly on HSE external crystal and that usb peripheral is clocked at 48 Mhz
to determine the PLL multipliers you can try this utility
viewtopic.php?t=78

I've changed the board to Blackpill STM32401CC and loaded the script again and still no serial port available in Windows Device Manager.

I'm not experienced at coding so I'm not sure what the link is about. Do I copy that into the Arduino IDE and load it??
STM32-3.jpg
STM32-3.jpg (71.21 KiB) Viewed 7266 times
User avatar
Bakisha
Posts: 139
Joined: Fri Dec 20, 2019 6:50 pm
Answers: 5
Contact:

Re: STM32F401CCU Black Pill not detected by Win 7

Post by Bakisha »

BlackPill F401CC is for boards with 25MHz crystal
Generic F401CCUx is for boards with 8MHz crystal

You must select "USB support->CDC (generic Serial supersede U(S)ART)" from menu or "Serial" will on serial port (PA9/PA10), not as recognizable USB device.
Clipboard01.jpg
Clipboard01.jpg (94.67 KiB) Viewed 7243 times
If you still can't see port in device manager, try deleting driver, and click "scan for hardware change" from device manager.
While in device manager, click "view->show hidden devices" and uninstall all unknown devices.
Or try different USB ports (front/back) on PC.
Or try different USB cable.

Check if 3.3V regulator is working. It is recommended that when powering from both USB and ST-LINK to use only GND/SWSCK/SWDIO, and not 3.3V connected.
warjon
Posts: 5
Joined: Tue Nov 21, 2023 11:04 pm

Re: STM32F401CCU Black Pill not detected by Win 7

Post by warjon »

Bakisha wrote: Thu Nov 23, 2023 2:23 pm BlackPill F401CC is for boards with 25MHz crystal
Generic F401CCUx is for boards with 8MHz crystal

You must select "USB support->CDC (generic Serial supersede U(S)ART)" from menu or "Serial" will on serial port (PA9/PA10), not as recognizable USB device.
Clipboard01.jpg
If you still can't see port in device manager, try deleting driver, and click "scan for hardware change" from device manager.
While in device manager, click "view->show hidden devices" and uninstall all unknown devices.
Or try different USB ports (front/back) on PC.
Or try different USB cable.

Check if 3.3V regulator is working. It is recommended that when powering from both USB and ST-LINK to use only GND/SWSCK/SWDIO, and not 3.3V connected.

Thank you to all that have assisted me in getting this working.

This last post solved the issue and I now have upload capability via STLink and Serial communications via USB so I can tune the PID. thanks again Warren
Post Reply

Return to “General discussion”