Skip to main content
David Pekin
Senior
February 14, 2018
Question

Serial over ST-Link USB on stm32F722

  • February 14, 2018
  • 2 replies
  • 2046 views
Posted on February 14, 2018 at 21:29

Hello,

I've developed a program reading and writing serial data using USART6 and pins 6 & 7 on GPIOC.  It uses DMA to perform the RX & TX and is working fine.  We thought we might be able to save some wiring effort if we could use the ST-Link serial port on the USB so I changed USART6 to USART3 and the tx rx pins to 8/9 on GPIOD.  I also changed the baud rate way down to 9600 for testing. 

Unfortunately this 'simple' change did not work.  When I send a serial command to the ST-Link serial port, the program has a catastrophic failure and ends in an exception.  The transmit and receive callbacks are never fired.

Is there some limitation on the use of the ST-Link serial channel that prevents this?  Also, the failure occurs whether the debugger is running or not.

Thanks for any insight here.

    This topic has been closed for replies.

    2 replies

    Tesla DeLorean
    Guru
    February 14, 2018
    Posted on February 14, 2018 at 22:39

    Using other NUCLEO-144 board with USART3 PD8/PD9 without issue.

    Make sure to have the IRQ Handler configured correctly to call into the HAL, and thus back into your callbacks.

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    David Pekin
    Senior
    February 15, 2018
    Posted on February 15, 2018 at 02:54

    Thanks.  Since the USART6 interrupts were working correctly, I assume that the only changes I would need to make would be in the main.h file, changing the Port and Pins and AF assignment.  Is there something else I'd need to change?  The DMA channels work with any USART, right?  

    Tesla DeLorean
    Guru
    February 15, 2018
    Posted on February 15, 2018 at 03:15

    Routing from the physical interrupt sources (DMA, USART, etc) would need to be described in stm32f7xx_it.c

    void USART3_IRQHandler(void)

    {

    HAL_UART_IRQHandler(&Uart3Handle);

    }
    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    T J
    Senior III
    February 15, 2018
    Posted on February 15, 2018 at 04:40

    I have configured the minimal parts for you

    ________________

    Attachments :

    F722ZE.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HxxN&d=%2Fa%2F0X0000000b2v%2FjDHb87CoeNp1_t0xaSOzeyZq2WjOZbwUhirtrGDbC1g&asPdf=false
    David Pekin
    Senior
    February 15, 2018
    Posted on February 15, 2018 at 05:32

    Thanks TJ and Clive.

    I’ll check out that code tomorrow and install the cube s/w.  

    It’s funny how each processor has its own learning curve and challenges. I’ve written plenty of interrupt driven routines for a variety of targets for longer than I like to admit. This is my first project with the STM32 and it has plenty of peripherals to configure and get to work together - CAN, I2C, USARTS, timers, PWM, quadrature encoders, and a few I’m not thinking of the top of my head.  And a tight delivery timeline!  What could go wrong!?!?

    Thanks for all the support you and this forum provides!

    Cheers!