Menu

#46 CORTEX_STM32F103_GCC_Rowley Demo has serious flaws in driver

open
nobody
None
1
2010-10-28
2010-10-28
Al Williams
No

Posting as requested.

In the CORTEX_STM32F103_GCC_Rowley demo there is a driver named STM_USART.c. It works fine on USART1 but has seriously incorrect code on USART2 and does not work. There are some other changes required to make the demo work with the newer STM/Arm libraries too.

The three main issues are:
1) USART2 is not properly turned on.
Was:
RCC_APB2PeriphClockCmd( RCC_APB1Periph_USART2 | RCC_APB2Periph_GPIOA, ENABLE );

Is:
RCC_APB1PeriphClockCmd( RCC_APB1Periph_USART2 , ENABLE );
RCC_APB1PeriphClockCmd( RCC_APB2Periph_AFIO , ENABLE );

(Note the AFIO is the correct thing to turn on although this is turned on elsewhere so that error doesn't affect the demo).

2) DMA is turned on for both USARTs but then not set up so its not needed.

3) The USART2 ISR is empty. I factored the code out of USART1's ISR and then pointed both ISRs at the new static subroutine (see attached).

A quick diff shows the other changes are mostly changing headers for the newer libraries. The original demo doesn't use USART2 so this is only apparent if you try to use USART2. The other CORTEX M demo's use a less ambitious serial.c -- I assume that works.

Discussion

  • Al Williams

    Al Williams - 2010-10-28

    Corrected Driver

     
  • Al Williams

    Al Williams - 2010-10-28

    Diff from original

     
  • Al Williams

    Al Williams - 2010-10-28
    • priority: 5 --> 1
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.