2017-11-09 08:42 PM
Hi,
I used STM32F103 MCU before and was new for STM32F3x MCU. My stm32f103 codes was migrated to stm32f302 codes for stm32f302r8 MCU.The code problem is that after power on, MCU turned on LED normally and printed out ''0123456789'' only (full string should be '1234567890'), and then got stuck. Attached please find my stm32f302 codes. Can anyone expert help me to fix this issue? Thanks in advance.
2017-11-10 09:00 AM
Use TXE to determine the DR is EMPTY before stuffing data, don't use TC for that purpose.
/*********************************************************************
* @brief Print character for USART */void USART_PrintChar(USART_TypeDef* USARTx, u8 ch){ while (USART_GetFlagStatus(USARTx, USART_FLAG_TXE) == RESET); // empty, ready for new data USARTx->TDR = ch; //USARTx->DR = ch;}/*********************************************************************
* @brief Print string for USART */void USART_PrintStr(USART_TypeDef* USARTx, char *str){ while(*str) USART_PrintChar(USARTx, *str++);while (USART_GetFlagStatus(USARTx, USART_FLAG_TC) == RESET); // Wait complete if must
}/*********************************************************************
2017-11-11 01:39 AM
Many Thanks for the replay.
I found the major issue is inside routine '
NVIC_Configuration()'.
=================================
void NVIC_Configuration(void)
{NVIC_InitTypeDef NVIC_InitStructure;NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x6000); <== I uploaded firmware which started from memory 0x00 (without bootloader), so should remove this line.NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);....
}
=================================