2015-03-31 08:57 AM
Hi I am trying to jump to the bootloader on F429z with using B0 B1 pins
using the code belowbut when i send 0x7f on uart1 (from my remote client app) I get no response back at allI have confirmed Buad rate 57600 8e1 with logic analyser.The Stack Pointer is set to the Value( 0x20002d40) I see in address 0x1FFF0000. Is this correct?Any Ideas to why i get no response?Thanksvoid (*SysMemBootJump)(void);void BootLoaderInit(uint32_t BootLoaderStatus){SysMemBootJump = (void (*)(void)) (*((uint32_t *) 0x1FFF0004)); if(BootLoaderStatus ==1) { //Shut down any tasks running __set_PRIMASK(1); //Disable Interupts HAL_UART_MspDeInit(&UartHandle); HAL_RCC_DeInit(); SysTick->CTRL = 0; //reset systic timer SysTick->LOAD = 0; SysTick->VAL = 0; __set_MSP(0x20002d40); //Set the main stack pointer to its default values SysMemBootJump(); while(1);} #bootloader-started-by-software #groundhog-day2015-03-31 10:11 AM
Ok, so why not load the value for the stack pointer from the ROM, rather than assume it's a fixed value?
Also you'd want to consider what memory is mapped at ZERO. Covered this in a bunch of threads.2015-04-01 05:08 AM
Thanks Clive
I changed to belowBut It still have no response from the Uart when I send 0x7fI am new to STM32 and obviously missing something Ideas?Thanksvoid (*SysMemBootJump)(void);void BootLoaderInit(uint32_t BootLoaderStatus){ SysMemBootJump = (void (*)(void)) (*((uint32_t *) 0x1FFF0004)); if(BootLoaderStatus ==1) { //Shut down any tasks running __set_PRIMASK(1); //Disable Interupts HAL_UART_MspDeInit(&UartHandle); HAL_RCC_DeInit(); SysTick->CTRL = 0; //reset systic timer SysTick->LOAD = 0; SysTick->VAL = 0; SYSCFG->MEMRMP = SYSCFG_MEMRMP_MEM_MODE_0 ; ///debug SYSCFG_MEMRMP_MEM_MODE_0 = remap 001 = system uint32_t p = (*((uint32_t *) 0x1fff0000)); /// debug p returns 0x20002d40 __set_MSP(p); //Set the main stack pointer to its defualt values SysMemBootJump(); while(1); }}2015-04-01 05:36 AM
The boot loader expects to be started with close to reset conditions. Odds are you're very far away from doing that, and consequently it fails.
2015-04-01 07:31 AM
Another option is to set the desired reset source in SYSCFG_MEMRMP and than to do a Vector reset via SCB_AIRCR_VECTRESET. This will reset the core and all interrupts, but leave the device registers and so the reset mapping as set.
2015-04-01 08:02 PM
2015-04-02 05:14 AM
libopencm3 defines
void scb_reset_system(void) { SCB_AIRCR = SCB_AIRCR_VECTKEY | SCB_AIRCR_SYSRESETREQ; while (1); } This is used in the blackmagic debug probe and works for me.2015-04-03 05:31 AM
I tried your code
It jumps to Bootloader But I am still having the same Problem. NO Uart response.I tried a NEW PCB and same issue.?2015-04-03 06:45 AM
So can you use a debugger and step into the ROM. When it's not responding via the USART can you stop it and see where it is?
Try jumping to the boot loader immediately, does that work?; In startup_stm32f4xx.s
; ...
Reset_Handler:
; Add this code up first
LDR R0, =0x40023844 ; RCC_APB2ENR
LDR R1, =0x00004000 ; enable SYSCFG clock
STR R1, [R0, #0]
LDR R0, =0x40013800 ; SYSCFG_MEMRMP
LDR R1, =0x00000001 ; remap ROM at zero
STR R1, [R0, #0]
LDR R0, =0x1FFF0000 ; load ROM base
LDR SP,[R0, #0] ; assign main stack pointer
LDR R0,[R0, #4] ; load bootloader address
BX R0
; ...
2015-04-03 07:54 AM
And what about the hardware?
Does the uart works in ''normal'' mode? Did you add pull ups to the rx/tx line? http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf