cancel
Showing results for 
Search instead for 
Did you mean: 

Serial over ST-Link USB on stm32F722

David Pekin
Senior
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.

9 REPLIES 9
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 Venmo
Up vote any posts that you find helpful, it shows what's working..
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?  

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 Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on February 15, 2018 at 03:20

Its best to enable it in the cube, to handle the correct DMA configurations.

I would suggest that you swap it back to Uart 6,  go to the cube and initialise the second/third serial ports. as needed.

then it will be seamless.

T J
Lead
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
Posted on February 15, 2018 at 03:40

Thanks but I haven't used the cube s/w so that's got it's own learning curve.  I've used the example programs as a foundation and built up from there.  

Posted on February 15, 2018 at 03:47

the cube is extremely easy to use and configure.

not much of a learning curve really,

in fact I think a a shorter path to completion since you dont have to troubleshoot how each DMA is configured .

which processor is it ?

I can dummy up a serial port for you.

Posted on February 15, 2018 at 03:58

NUCLEO-F722ZE   STM32F722ZE  

http://www.st.com/en/evaluation-tools/nucleo-f722ze.html

 
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
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!