2022-09-12 02:26 PM
I am attempting to modify the GCC/make demo source for OpenBLT Olimex STM32 P405 board for use on a custom PCB:
I have had to modify the clock setup by using Cube and pasting in the generated code as I am using a 16mhz HSE. The OpenBLT header file and macros for the frequency didn't permit the board to work at all. I have also moved to UART3 as that is what my hardware uses.
Ultimately, I would like to be able to use RS232/UART to do a simple firmware upgrade. Using the host tools (BootCommander) and an FTDI adapter, I can never get a connection. The PC is clearly sending but not receiving. The wiring and setup works fine as-is with other code that uses the UART (i.e. a shell), so it is not the hardware or wiring.
Baud rate is 57600 8N1 on both sides. My gut feeling is that the clock configuration is incorrect for UART3 peripheral somehow but I am relatively new to the HAL LL driver and would appreciate assistance.
Note: I have the blinking LED, indicating activity and at least the Watchdog LED blinker is functioning.
Complete Source Pastebin --> main.c
My imported LL clock settings from CubeMX for HSE:
void SystemClock_Config(void) {
LL_FLASH_SetLatency(LL_FLASH_LATENCY_5);
while (LL_FLASH_GetLatency() != LL_FLASH_LATENCY_5) {
}
LL_PWR_SetRegulVoltageScaling(LL_PWR_REGU_VOLTAGE_SCALE1);
LL_RCC_HSE_Enable();
/* Wait till HSE is ready */
while (LL_RCC_HSE_IsReady() != 1) {
}
LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSE, LL_RCC_PLLM_DIV_8, 168,
LL_RCC_PLLP_DIV_2);
LL_RCC_PLL_Enable();
/* Wait till PLL is ready */
while (LL_RCC_PLL_IsReady() != 1) {
}
LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1);
LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_4);
LL_RCC_SetAPB2Prescaler(LL_RCC_APB2_DIV_2);
LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL);
/* Wait till System clock is ready */
while (LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL) {
}
LL_SetSystemCoreClock(168000000);
/*
if (HAL_InitTick(TICK_INT_PRIORITY) != HAL_OK) {
Error_Handler();
}*/
Complete blt_conf.h pastebin --> bltconf
2022-09-12 02:46 PM
Make sure it knows you're using a 16 MHz clock (perhaps check also HSE_VALUE define if it uses that)
2022-09-12 03:12 PM
I do have #define BOOT_CPU_XTAL_SPEED_KHZ (16000) set in the blt_conf.h system as I am using a 16mhz HSE. The MCU is clearly in a normal operating state as I have a blinky. It seems like the timing is off for the UART (in rs232.c) but I can't nail it down.
It's a shame, because it seems like an excellent bootloader. It seems like there is no support unless you are a paid commercial customer. I have no problem paying for a little assistance as I am many hours into this.