Other Parts Discussed in Thread: MSP430FR5994
HI teams:
I am currently doing SPI communication between two chips. MSP430 is used as a slave. I want the slave to receive data through DMA, then parse it and then send the data through DMA. But currently I have encountered a problem. Since the length of each frame of data sent by the host is different, I want to know how to receive data of variable length on this chip.
void BMS_DMA_Rx_Init(void)
{
DMACTL1 |= DMA2TSEL__UCA0RXIFG ;
DMACTL4 |= DMARMWDIS ;
DMA2CTL |= DMADT_4 + DMADSTINCR_3 + DMASRCINCR_0 + DMADSTBYTE_1 + DMASRCBYTE_1 + DMALEVEL_0 + DMAEN + DMAREQ ;
DMA2SA = (uintptr_t)EUSCI_A_UART_getReceiveBufferAddress(EUSCI_A0_BASE);
DMA2DA = (uint8_t)(uintptr_t)RecV_ping ;
DMA2SZ = 16 ;
}
Currently, I use the MSP430FR5994 development board and use the serial port debugging assistant to simulate the host sending a frame of data to the MSP430. My DMA trigger source is DMA2TSEL__UCA0RXIFG. That is, as long as the serial port sends data, the DMA will start conversion and move the data to the RecV_ping array.
First send a frame of data through the serial port debugging assistant

msp430 receives as follows:

When I send the second frame the same command

The first byte of MSP430 starts from RecV_ping [15],rather than RecV_ping [0]

If this continues, the data in my array will be out of order.If the length of the data I transmit each time is not equal, it will definitely cause the next data transmission to fill in the gaps in the previous data transmission, and then re-overwrite the value of the current array.
In the current code, I only initialize the serial port code and initialize the DMA. I have neither used the serial port reception interrupt nor the DMA interrupt. So in this case, what should I do? Are there any good ideas?
I hope some experts can read it patiently and make better suggestions.
I look forward to your reply, thank you
By the way, I want to implement SPI+DMA communication method. At present, I am only experimenting on the development board, using UART+DMA. I think the two are almost the same.