Hello, i am new in ChibiOS. Is there any examples of data receiving through UART with DMA? It's pretty hard to understand how uart receiving works.
where received data counter located?
this is the algorithm of my actions:
1) configuring uart (example style)
2) in main in "while" called
uartStartReceive();
3)then
osDelay(700);
I see the data in debug but i do not know where is data counter. I will be grateful for the link to an example or advice.
Thank you!
Best wishes!
UART with DMA Receiving example
Moderator: RoccoMarco
- Giovanni
- Site Admin
- Posts: 14893
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: UART with DMA Receiving example
Hi,
The uartStartXXXX() functions are asynchronous, the end of the operation is signaled by a callback which can be not exactly easy for a first approach.
Note that the driver also has functions without "Start" in the name, those are synchronous, the function returns when the operation is done, you may try those initially if you don't need the complexity associated to callbacks. Try uartReceive(), uartReceiveTimeout(), uartSend() etc for example.
Giovanni
The uartStartXXXX() functions are asynchronous, the end of the operation is signaled by a callback which can be not exactly easy for a first approach.
Note that the driver also has functions without "Start" in the name, those are synchronous, the function returns when the operation is done, you may try those initially if you don't need the complexity associated to callbacks. Try uartReceive(), uartReceiveTimeout(), uartSend() etc for example.
Giovanni
Re: UART with DMA Receiving example
Thanks for advice, Giovanni. When I tried synchronous function, the program went into rxchar callback. When I tried asynchronous function, the program did not go into rxend callback. Same time program went into txend2 callback when i tried to send data through asynchronous function.
I can see it in debug with breakpoints and leds. Also program never went into rxerr callback. Looks like program never went into rxend callback but data still receiving. I have no ideas about it.
I am using UARTD1 and my UARTConfig looks like:
static UARTConfig uart_cfg_1 = {
txend1,
txend2,
rxend,
rxchar,
rxerr,
115200,
0,
USART_CR2_LINEN | USART_CR2_STOP1_BITS,
0
};
Thank you!
Best wishes!
I can see it in debug with breakpoints and leds. Also program never went into rxerr callback. Looks like program never went into rxend callback but data still receiving. I have no ideas about it.
I am using UARTD1 and my UARTConfig looks like:
static UARTConfig uart_cfg_1 = {
txend1,
txend2,
rxend,
rxchar,
rxerr,
115200,
0,
USART_CR2_LINEN | USART_CR2_STOP1_BITS,
0
};
Thank you!
Best wishes!
- Giovanni
- Site Admin
- Posts: 14893
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: UART with DMA Receiving example
Hi,
Synchronous functions only handle rxchar and rxerr callbacks. Being synchronous there is no need for the other callbacks, just put those to NULL.
Giovanni
Synchronous functions only handle rxchar and rxerr callbacks. Being synchronous there is no need for the other callbacks, just put those to NULL.
Giovanni