I am trying to use DMA with the uart1 (USART3) interface to send data between the AI Deck 1.1 GAP chip and the Crazyflie2.1 (firmware side).
I am successful at sending/receiving using the uart1.h interface provided without DMA. However, when I set -DENABLE_UART1_DMA, I get a redefinition linking error when building: DMA1_Stream3_IRQHandler function is defined both in uart1.c and in ~/src/drivers/src/uart1.c and in ~/src/hal/src/sensors_bmi088_spi.c. The uart1.c source code has the following comment, however:
Code: Select all
/** This uart is conflicting with SPI2 DMA used in sensors_bmi088_spi_bmp388.c
* which is used in CF-Bolt. So for other products this can be enabled.
*/
//#define ENABLE_UART1_DMA
Refer to the attached image for a visual table of the interfaces that are trying to use the DMA resource.
Furthermore, I was successful in configuring DMA to handle USART3 RX operations in my own file separate from uart1.c and this feature works. However, I also need the TX operations with DMA because I have the following issue with the non-DMA uart1 interface: When I send 16 Bytes via UART in the controller loop, everything works. However, when I increase the packet size I send to 20 Bytes, the Kalman rate supervisor tells me it is slow (94-95 range). I have determined that this delay is originated in the uart1.c for-loop:
Code: Select all
void uart1SendData(uint32_t size, uint8_t* data)
{
uint32_t i;
if (!isInit)
return;
for(i = 0; i < size; i++)
{
while (!(UART1_TYPE->SR & USART_FLAG_TXE));
UART1_TYPE->DR = (data[i] & 0x00FF);
}
}
Is the DMA1_Stream3 being used by the Crazyflie2.1 (for example by the bmi088_spi interface)? If not, I would appreciate a bit of guidance on how to modify the code so that the resource (DMA1_Stream3) is freed-up for USART3 TX use.
Thank you for your time and help,
Victor Freire
University of Wisconsin-Madison
freiremelgiz@wisc.edu