2018-05-07 02:31 AM
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
2018-05-07 06:39 AM
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
2018-05-07 08:52 AM
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
2018-05-07 10:43 AM
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.
2018-05-10 12:29 PM
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)0x08008000extern 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;
2018-05-10 08:16 PM
Many Many Many thanks buddy, I will try it right away.