STM32f7 serialDriver rx interrupt

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderators: RoccoMarco, barthess

Amir1980
Posts: 12
Joined: Tue Jan 03, 2023 4:03 pm
Has thanked: 2 times

STM32f7 serialDriver rx interrupt

Postby Amir1980 » Thu Jan 05, 2023 11:21 am

Hi,

I am new to ChibiOS and this forum, I have a NUCLEO-F746ZG board and would like to try chibios. I want to test serial driver and uart driver to send and receive some fix size data, I used RT-STM32F746ZG-NUCLEO144 demo to find functions of chibios HAL library, in this demo the serial driver is used to send messages to the host computer using USART3 at baudrate of 115200 :

Code: Select all

sdStart(&SD3,&sd3cfg);

I can send bytes to the host computer with sdPut like this :

Code: Select all

    uint8_t msg[13] = "helloWorld2\r\n";
    for (int i=0; i<13; i++)
    {
      sdPut(&SD3,msg[i]);
    }


my question is how can I start rx interrupt of usart3 to receive and store incoming bytes from host computer to a buffer? may I use DMA for large and high frequency incoming data using serial driver? how to implement it?

I didn't found any example of rx interrupt implementation in chibios.

Regards,
Amir.

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: STM32f7 serialDriver rx interrupt

Postby Giovanni » Thu Jan 05, 2023 11:50 am

Hi,

It is because in ChibiOS you don't usually manage interrupts, it is the driver doing that. The serial driver already has an internal buffer and interrupts are handled internally. Just use sdGet() in order to read from the buffer.

Giovanni

Amir1980
Posts: 12
Joined: Tue Jan 03, 2023 4:03 pm
Has thanked: 2 times

Re: STM32f7 serialDriver rx interrupt

Postby Amir1980 » Thu Jan 05, 2023 3:28 pm

Hi,

Thanks, do I need to set buffer size anywhere? what about the DMA? does serial driver handle it too? how do I tell driver to use DMA or not to use DMA? in freeRTOS I can use queue to transfer received data from DMA buffer in an interrupt to a thread and parse received data in that thread, how can I achieve it in chibiOS?

Regards,
Amir.

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: STM32f7 serialDriver rx interrupt

Postby Giovanni » Thu Jan 05, 2023 4:05 pm

Hi,

The serial driver does not use DMA, it is purely buffered and interrupt-driven, there are other drivers that allow to use DMA: SIO (indirectly) and UART (built in the driver).

Buffer size is an option in halconf.h (SERIAL_BUFFERS_SIZE).

Giovanni

Amir1980
Posts: 12
Joined: Tue Jan 03, 2023 4:03 pm
Has thanked: 2 times

Re: STM32f7 serialDriver rx interrupt

Postby Amir1980 » Thu Jan 05, 2023 4:47 pm

Hi,

do you have any example of using uart driver with DMA? does uart driver handle the interrupts too? how to enable and use uart driver instead of serial driver?

Regards,
Amir.

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: STM32f7 serialDriver rx interrupt

Postby Giovanni » Thu Jan 05, 2023 4:59 pm

Hi,

Look under /testhal, all example applications are there.

Giovanni


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 11 guests