2021-11-07 08:08 AM
I have 7 binary variable that I want to continously send to uart with the DMA.
I do not want to use ascii format, I want to send binary data.
If I use multiple DMA transmits in a row, just some are beeing send due to the fact, that when the second is triggered the first is still beeing transmited.
How can I create a 20byte long variable in which I can store the data and send it with one command?
It is easily possible to send a 20byte sentence so it should be possible to create a 20byte variable.
Or am I overthinking it? can I construct an array and send the array at once.
I want to use DMA because the amount of data is getting bigger in the future.
Solved! Go to Solution.
2021-11-07 08:14 AM
Make them co-located in memory and send the whole thing.
struct DataStruct {
uint32_t x[3];
uint16_t y[4];
};
DataStruct data;
data.x[0] = 1;
...
HAL_UART_Transmit_DMA(&huart1, (uint8_t *) &data, sizeof(data));
2021-11-07 08:14 AM
Make them co-located in memory and send the whole thing.
struct DataStruct {
uint32_t x[3];
uint16_t y[4];
};
DataStruct data;
data.x[0] = 1;
...
HAL_UART_Transmit_DMA(&huart1, (uint8_t *) &data, sizeof(data));
2021-11-07 08:34 AM
This works beautifully.
Very elegant as well.
Kudos and thank you from Berlin