I recently ported FreeRTOS to an STM32 target board and started with the CORTEX_STM32F103_GCC_Rowley demo.
There are a number of small issues there if you try to use the new device library, etc. However, the USART driver has some serious problems. I’d assume no one has actually tried to use the second serial port on the demo.
The biggest issue is the init code has:
RCC_APB2PeriphClockCmd( RCC_APB1Periph_USART2 | RCC_APB2Periph_GPIOA, ENABLE );
This should be:
RCC_APB1PeriphClockCmd( RCC_APB1Periph_USART2 , ENABLE );
RCC_APB1PeriphClockCmd( RCC_APB2Periph_AFIO , ENABLE );
The way the code is set up, the AFIO vs GPIO error is harmless, but still wrong. But USART2 never gets lit up using the exisiting driver.
A few other things. The driver turns on DMA for both USARTs but doesn’t configure it. This seems to be harmless, but is unnecessary. And the IRQ for USART2 is empty! It is easy to copy the USART1 ISR or – what I did – factor it out and make both IRQs call the worker function.
Al W