cancel
Showing results for 
Search instead for 
Did you mean: 

Need information about Bootloader via USB-COM (virtual com port) for STM32F103

alireza nazem
Associate II
Posted on May 07, 2018 at 11:31

Hello everyone, 

Does anybody know any available bootloader via usb-com (virtual com port) for STM32F103 series? or any written codes for it? or if not please instruct me how to start writing my own codes. frankly i am new here and just made my very first codes. I used UART1 to upload my codes to MCU but I need to use USB-COM for firmware update. Thank you   

5 REPLIES 5
Posted on May 07, 2018 at 15:39

Should be some IAP examples for the EVAL boards that should be portable to the board you are using.

For USB connectivity, direct to the part, consider DFU

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on May 07, 2018 at 15:52

Hi, Thanks replying. actually I am asked to develop via USB virtual COM and not DFU for some reasons. am I on the right path if I learn how to read and write to the flash? what else do i need to know ? Thanks in advance   

Posted on May 07, 2018 at 17:43

I would likely buffer data provided in the USB interrupt, and then flash in a separate task/thread. Writing and erasing flash can stall the processor, and you'd want to avoid doing that in an interrupt, and on a device will real-time expectations.

The IAP implementation uses Y-Modem to manage blocks of data sent from a Terminal application running on a PC.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on May 10, 2018 at 19:29

To address somewhat the question posed privately, related to this thread...

https://community.st.com/0D50X00009XkYIfSAN

On the loader side the control transfer is accomplished in this manner, ideally without all interrupts up and firing.

/* Define the address from where user application will be loaded.

Note: the sectors 0x08000000-0x08007FFF are reserved for the IAP/Loader code */

#define APPLICATION_ADDRESS (uint32_t)0x08008000

extern pFunction Jump_To_Application;

extern uint32_t JumpAddress;

/* Test if user code is programmed starting from address 'APPLICATION_ADDRESS' */

if (((*(__IO uint32_t*)APPLICATION_ADDRESS) & 0xFFFE0000 ) == 0x20000000) // Stack is in RAM, rough test

{

/* Jump to user application */

JumpAddress = *(__IO uint32_t*) (APPLICATION_ADDRESS + 4);

Jump_To_Application = (pFunction) JumpAddress;

/* Initialize user application's Stack Pointer */

__set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS);

Jump_To_Application();

}

On the application side of the fence

/*!< Uncomment the following line if you need to relocate your vector Table in

Internal SRAM. */

/* #define VECT_TAB_SRAM */

#define VECT_TAB_OFFSET 0x8000 /*!< Vector Table base offset field.

This value must be a multiple of 0x */

/**

* @brief Setup the microcontroller system

* Initialize the Embedded Flash Interface, the PLL and update the

* SystemFrequency variable.

* @param None

* @retval None

*/

void SystemInit(void)

{

...

/* Configure the Vector Table location add offset address ------------------*/

#ifdef VECT_TAB_SRAM

SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */

#else

SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */

#endif

}

or simply

SCB->VTOR = APPLICATION_ADDRESS;

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on May 11, 2018 at 03:16

Many Many Many thanks buddy, I will try it right away.