2017-08-24 08:18 AM
I am trying to utilizes the 'Flash Loader Demonstrator by STM' to download new firmware onto the STM32F072R8 chip and I will not be able to use the pin BOOT0 on my board. The idea is to use the main program to jump to system bootloader and use USART3 to communicate with the Flash Loader.
My board has 4 UARTs that are connected to other sensor and devices. USART1 is used for a LTE device, UART2 is used for a GPS device,USART3 is used to connect to PC, and USART4 is used for a LORA device. To test the bootloader, I have a relay that is connected to a GPIO pin. Onces the GPIO pin goes high, the program goes to the jumping function. The program correctly jumps to the system memory but the Flash Loader gets no response to the target. My main program does not initialize any of the Uarts. The only thing that I set up is the GPIO for the relay.
Below is the code that I am using for jumping. I am missing something in the jumping function.
USART3 is connected to PB10 and PB11. I have the RX and TX connected, correctly.
typedef struct{
uint8_t MODE;}sysState;// Relay 2 - brown wire to Connector
void Configure_PC0(void) {GPIO_InitTypeDef GPIO_InitStruct;
EXTI_InitTypeDef EXTI_InitStruct; NVIC_InitTypeDef NVIC_InitStruct; /* Enable clock for GPIOC */ RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC, ENABLE);/* Enable clock for SYSCFG */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE); GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN; GPIO_InitStruct.GPIO_OType = GPIO_OType_PP; GPIO_InitStruct.GPIO_Pin = GPIO_Pin_0; GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_DOWN; GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOC, &GPIO_InitStruct);}
int main(void)
{ sysState gState; gState.MODE = RUNMODE;Timers_Init(); Led_Init(); Configure_PC0(); //Turn off the Led's Initially Led_State(LED_OFF, LED1); Led_State(LED_OFF, LED2); Led_State(LED_OFF, LED3);Led_PowerOn();
uint8_t ON_OFF; for(;;) {ToggleHeartbeat(); // toggle LED1
ON_OFF = GPIO_ReadInputDataBit(GPIOC, GPIO_Pin_0); //read relay if(gState.MODE==BOOTMODE || ON_OFF== 1) { // pin pin is pressed Led_State(LED_ON, LED2); Led_State(LED_ON, LED3); // JUMP to internal system bootloader jumpBootloader(1); } }}void jumpBootloader(char i)
{
void (*SysMemBootJump)(void); * For STM32F072, system memory is on 0x1fffC800 */ volatile uint32_t addr = 0x1fffC800; RCC_DeInit();// Step: Disable systick timer and reset it to default values SysTick->CTRL = 0; SysTick->LOAD = 0; SysTick->VAL = 0; __disable_irq(); SYSCFG->CFGR1 = 0x01; SysMemBootJump = (void (*)(void)) (*((uint32_t *)(addr + 4))); __set_MSP(*(uint32_t *)addr); SysMemBootJump();/**
* Step: Connect USB<->UART converter to dedicated USART pins and test * and test with bootloader works with STM32 Flash Loader Demonstrator software */}#uart3 #boot0 #stm32f072 #bootloader2017-08-24 10:18 AM
>>Below is the code that I am using for jumping. I am missing something in the jumping function.
Not really the method I've demonstrated/advocated. Try stepping and debugging it. Try doing the mapping and then jumping via the 0x00000000 address not 0x1FFFC800, or at least confirm you can see the ROM at zero.
You disable the interrupts on the processor, where do you expect them to be enabled?
The System Loader expects all the non USART3_RX pins to be quiet, it is looking for signals. Consider writing your own loader.
2017-08-24 11:51 AM
I am having the same problem with my target getting no response on any usart at all. Even the boot0 pin doesn't work for me. My hardware setup with usart and terminal is working fine so no problem with communication.
I tried sending 0x7F hex using terminal with pin boot0=1 and get no response. Do you have atleast that working on any other ports Raj?
2017-08-25 08:48 AM
I have not tried putting the boot0 pin high, yet. I will try the bootloading on the stm32fo discovery board to keep things simple. I am going to try each UART connection UART1, UART2, UART3 and see what results.
2017-08-25 09:39 AM
I got the bootloader to work USART 1. I disconnected the debugger , I was able to program with the demo programer
2017-08-25 10:02 AM
Before going off the deep end, the pins/USARTs supported by the System Loader on the STM32F07xx are
USART1 PA9/PA10
USART2 PA14/PA15 - Likely to conflict with SWD debugger
2017-08-25 10:50 AM
I will give USART 1.
2017-08-25 06:33 PM
On one of the posts someone mentioned they were able to succeed after kept trying a few times. You can try that on usart 3 and see if that works.
2017-08-25 06:35 PM
Think we pretty much established that USART3 isn't supported in any configuration.