2025-01-21 08:33 AM - edited 2025-01-22 04:56 AM
If Systembootloader Doesnt detect anything comming from any peripheral, does it timeout and jump to 0x8000000?
Because by reading AN3154 , it looks like it does, but when im trying with my stm32f405RE it doesn
this is my code:
int main(void)
{
/* USER CODE BEGIN 1 */
#define BOOTLOADER_ADDRESS 0x1FFF77DE
typedef void (*pFunction)(void);
pFunction JumpToApplication;
uint32_t JumpAddress;
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
/* USER CODE BEGIN 2 */
HAL_Delay(1000);
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
HAL_Delay(250/2);
HAL_GPIO_TogglePin(LEDRED_GPIO_Port, LEDRED_Pin);
if(HAL_GetTick()>10000){
/* Jump to system memory bootloader */
JumpAddress = *(__IO uint32_t*) (BOOTLOADER_ADDRESS + 4);
JumpToApplication = (pFunction) JumpAddress;
JumpToApplication();
}
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}
What im expecting:
But im only reaching point 3, and stays there.
2025-01-21 08:42 AM
Maybe im not even jumping to SystemBootloader, ill check tomorrow
2025-01-21 09:04 AM
Primary move your jump before hal init. Secondary address you use isnt ok. Here is ID if loader not start.
AN2606 try 1fff0000
2025-01-22 04:03 AM - edited 2025-01-22 05:18 AM
The memory location is what AN2606 says
so
0x1FFF77DE
should be alright.
You were right for some reason 0x1FFF0000 is the actual address
By disabling interruptions and sysclock i am able to get into Sysbootloader, but it doesnt timeout, i am able to do firmware updates, but if no CAN comms are going on it doesnt jump to 0x8000000 like is supposed to do, in other words, once it gerts into systembootloader it never goes out.
/* USER CODE BEGIN WHILE */
while (1)
{
HAL_Delay(250/2);
HAL_GPIO_TogglePin(LEDRED_GPIO_Port, LEDRED_Pin);
if(HAL_GetTick()>10000){
/* Jump to system memory bootloader */
/* Disable all interrupts */
__disable_irq();
/* Disable Systick timer */
SysTick->CTRL = 0;
/* Set the clock to the default state */
HAL_RCC_DeInit();
/* Clear Interrupt Enable Register & Interrupt Pending Register */
for (uint32_t i=0;i<16U;i++)
{
NVIC->ICER[i]=0xFFFFFFFF;
NVIC->ICPR[i]=0xFFFFFFFF;
}
__enable_irq();
JumpAddress = *(__IO uint32_t*) (BOOTLOADER_ADDRESS + 4);
JumpToSystembootloader = (pFunction) JumpAddress;
JumpToSystembootloader();
}
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
2025-01-22 05:25 AM - edited 2025-01-22 05:27 AM
It doesnt jump from Systembootloader to 0x80000000 even if im using cubeProgrammer and selecting "Run after programming" option, i am able to execute my blinky code only after a Power reset or button Reset.
If "run after programming" is selected im not able to "Disconnect" without Cubeprogrammer crashing