cancel
Showing results for 
Search instead for 
Did you mean: 

Use CubeProgrammer as UART Mode

in mozbek we trust
Associate II

Hey there,

i want to reach my flash memory through UART. I can do this with ST-Link device but now i want to do it with UART. I use STM32F091CC MCU and as datasheet says i configured the UART pins(PA9-PA10) as Asynchronus UART in CubeMX.

My baud rate is 9600 bits/s- word legth 8bits - parity - even and stop bit is 1.

In boot mode configuration. I try to use all configurations but i cannot reach the flash memory.

I coded all options(set and clear bitss) in main.c program and when i click connect button in cube programmer it gives me an error like that:

Please help me how to solve this problem.

Regards

1 ACCEPTED SOLUTION

Accepted Solutions

I tried to use STM32F091 with UART connection and STM32CubeProgrammer. I used UART pins PA2 and PA3. I used Nucleo board with integrated USB to UART virtual COM port (VCP). Connection is correct - no problem. See attached screenshots: see there given UART configuration, option bytes configuration (I just set externally BOOT0 pin to VDD), device memory is empty (no code inside). Please check this configuration in your side.

0690X000006CKuPQAW.png 0690X000006CKuUQAW.png

View solution in original post

20 REPLIES 20
Igor Cesko
ST Employee

There is no need to program the device with any firmware - the UART is used for direct communication with device through embedded bootloader. So - just set device into boot mode (by setting BOOT0 and BOOT1 pins/option bits) and restart it and then connect to device by UART by CubeProgrammer.

Regards

Igor

It would need BOOT0 pulled high, or for you to implement the system loader protocol.

In your own application, just use a regular terminal program, and implement something like X-MODEM, or Y-MODEM supported by the terminal. See the IAP examples for how this is done.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

i pulled high boot0 but if there any solution to make this reprogram flash memory with cube programmer or FLASHER

Hey igor i have only physical boot0 pin and it aldreay pulled-up but i am not sure how to set or clear the other selectable pins like nboot0-boot_sel etc.

With BOOT0 High it should work, unless you have other interfaces creating noise on potential input pins. Review AN2606

https://www.st.com/content/ccc/resource/technical/document/application_note/b9/9b/16/3a/12/1e/40/0c/CD00167594.pdf/files/CD00167594.pdf/jcr:content/translations/en.CD00167594.pdf

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

In reference manual RM0091 see table in chapter "2.5 Boot configuration". There are two possible configuration how to enter into boot mode: the mode must be "System memory".

1) BOOT_SEL bit = 1, BOOT0 pin =1 , nBOOT1 bit = 1

2) BOOT_SEL bit = 0, BOOT0 bit =0 , nBOOT1 bit = 1

After option bytes programming please perform power-on reset (power off and on) - to be sure that the new option bytes are loaded.

BOOT0 pin is physical high and i do not anything in software it is okey. boot_sel and nboot1 is set by software like this:

 SET_BIT(FLASH->OBR,FLASH_OBR_nBOOT1);

 SET_BIT(FLASH->OBR,FLASH_OBR_BOOT_SEL);

I opened CubeProgrammer and click connect button and it doesnt change anything it still tell me same error

16:54:00 : Serial Port COM1 is successfully opened.

16:54:01 : Error: Activating device: KO. Please, verify the boot mode configuration and check the serial port configuration. Reset your device then try again... 

Maybe i have problems with restarting my mcu. What do you think about it

It seems OK. You can program the option bits also by STlink hardware and CubeProgrammer. You can check the option bits states also by CubeProgrammer (or by STlink Utility software) with connection with STlink.