cancel
Showing results for 
Search instead for 
Did you mean: 

SBSFU - writing to MODER stops UART

ChristoffMason
Associate

Hi There,

               I am trying to get our product working using the SBSFU on our product.  The latest problem I have is that the UART works when the application runs standalone - i.e. our code within the user app using the ST link, however, when I try to use the SBSFU, it doesn't work.

Here is some code to demonstrate the problem:

 

CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_USART2EN); //Disable the UART before writing to MODER as a precaution
for(i=0; i<30000000; i++) //Crude delay (no systick available)
{
WRITE_REG(IWDG->KR, IWDG_KEY_RELOAD);
}
CLEAR_BIT(GPIOA->MODER, GPIO_MODER_MODER2_0); //Set Alternative mode for both USART RX and TX (RA3 and RA2)
SET_BIT(GPIOA->MODER, GPIO_MODER_MODER2_1);
CLEAR_BIT(GPIOA->MODER, GPIO_MODER_MODER3_0);
SET_BIT(GPIOA->MODER, GPIO_MODER_MODER3_1);
while(1){}
 
When I execute this code as a standalone (user project only), the UART and rest of the program works fine, but when I use the bootloader it does not.  After hooking up the scope the first MODER write causes issues - TX drops from idle high to ground, so I assuming the UART gets disabled and/or GPIO config changes.  Any ideas would be appreciated,
Thanks
 
 
0 REPLIES 0