Tool/software:
Hello,
I am working on a project where i will receive different messages from another MCU using the SCI. The messages have different length and I wont be able to know wich message will be sent in advance. I decided to implement the SCI RX using the DMA, I configured my channel like so :
g_dmaCTRL g_dmaCTRLPKT1;
dmaReqAssign(DMA_CH0,DMA_SCI2_RX);
/*Configure control packet for Channel 0*/
g_dmaCTRLPKT1.SADD = (uint32_t)((uint8*)&(scilinREG->RD)+3); /* source address*/
g_dmaCTRLPKT1.DADD = (uint32_t)dma_rx_buf; /* destination address */
g_dmaCTRLPKT1.CHCTRL = 0; /* channel control */
g_dmaCTRLPKT1.FRCNT = BUFFER_SIZE; /* frame count */
g_dmaCTRLPKT1.ELCNT = 1; /* element count */
g_dmaCTRLPKT1.ELDOFFSET = 0; /* element destination offset */
g_dmaCTRLPKT1.ELSOFFSET = 0; /* element destination offset */
g_dmaCTRLPKT1.FRDOFFSET = 0; /* frame destination offset */
g_dmaCTRLPKT1.FRSOFFSET = 0; /* frame destination offset */
g_dmaCTRLPKT1.PORTASGN = 4;
g_dmaCTRLPKT1.RDSIZE = ACCESS_8_BIT; /* read size */
g_dmaCTRLPKT1.WRSIZE = ACCESS_8_BIT; /* write size */
g_dmaCTRLPKT1.TTYPE = FRAME_TRANSFER; /* transfer type */
g_dmaCTRLPKT1.ADDMODERD = ADDR_FIXED; /* address mode read */
g_dmaCTRLPKT1.ADDMODEWR = ADDR_INC1; /* address mode write */
g_dmaCTRLPKT1.AUTOINIT = AUTOINIT_ON; /* autoinit */
dmaSetCtrlPacket(DMA_CH0, g_dmaCTRLPKT1);
dmaSetChEnable(DMA_CH0, DMA_HW);
dmaEnable();
With this configuration my dma_rx_buf buffer is filled with RX data and I use a function in my main loop to parse the message and then handle them.I wanted to add another channel to my DMA but I had a question. The priority is configured to work in Rotation and with how i configured my CHN0 the task will not end until 1000 byte is received. The second channel was supposed to handle the transfer of data from a buffer to the TX line of the SCI. If i understood correctly I saw in the datasheet that the DMA had only one port so if i want to transmit with the CHN1 i will have to stop the CHN0 and both these channel cant transmit data at the same time ?