2019-01-01 06:06 PM
hello
I am using stm32l4 series microcontroller with keil mdk arm 5 programing.
Had successfully completed the booting process by manually setting boot0 pin and resetting the device using flash loader demo tool. Now i wanted to do the same without manual change of boot0 pin. Is it possible???Is there any tool for purpose??
Thanks
2019-01-01 06:31 PM
2019-01-01 07:32 PM
Which L4 part?
Something like this would probably work if the code isn't checking the flash
/*
In startup.s
Reset_Handler PROC
EXPORT Reset_Handler [WEAK]
IMPORT SystemInit
IMPORT __main
LDR R0, =0x20017FF0 ; Address for RAM signature
LDR R1, =0xDEADBEEF
LDR R2, [R0, #0]
STR R0, [R0, #0] ; Invalidate
CMP R2, R1
BEQ Reboot_Loader
LDR R0, =SystemInit
BLX R0
LDR R0, =__main
BX R0
ENDP ; Reset_Handler
Reboot_Loader PROC
EXPORT Reboot_Loader
LDR R0, =0x40021060 ; RCC_APB2ENR
LDR R1, =0x00000001 ; ENABLE SYSCFG CLOCK
STR R1, [R0, #0]
LDR R0, =0x40010000 ; SYSCFG_MEMRMP
LDR R1, =0x00000001 ; MAP ROM AT ZERO
STR R1, [R0, #0]
LDR R0, =0x1FFF0000 ; ROM BASE of L4
LDR SP,[R0, #0] ; SP @ +0
LDR R0,[R0, #4] ; PC @ +4
BX R0
ENDP ;sourcer32@gmail.com
In main.c */
//***************************************************************************
void BootDFU(void)
{
puts("Entering Boot Loader..");
*((unsigned long *)0x20017FF0) = 0xDEADBEEF; // 96KB
__DSB();
NVIC_SystemReset();
}
//***************************************************************************
2019-01-02 12:13 AM
STM32L432KX and bootloader using uart
2019-01-02 02:52 AM
Also what will be the state of BOOT0 pin??
2019-01-02 05:15 AM
You're defining the pin state externally, you've indicated that's LOW.
2019-01-02 08:06 AM
For the STM32L432 change the RAM address to 0x2000BFF0 or 0x2000FFF0 to place the magic value close to the 48K or 64K end of things.
2019-01-02 09:26 PM
i am going with backup register (rtc).
am i going right with the initialisations??
if (HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_9))
{
__HAL_RCC_PWR_IS_CLK_ENABLED();
HAL_PWR_EnableBkUpAccess();
__HAL_RCC_SRAM1_IS_CLK_SLEEP_ENABLED();
write_to_backup_rtc(1,0);
NVIC_SystemReset();
if(read_from_backup_rtc(1,0) == 1)
{
BootLoaderInit(1);
}
}
2019-01-17 10:46 PM
successfully done bootloading. but issue with the current consumption.
in bootloading mode -->> 0.015-0.016A
in programming mode -->> 0.003 - 0.004A
have given timer after which only my bootloading mode starts but it is sometimes showing correct output as expected (0.004A i.e. initially program is running than after sometime going in boot mode) and sometimes initially going in boot mode (0.016A).
Thanks in advance!