Gast
#2763492
Hallo zusammen PIC32MX795F512L Ich habe ein Problem beim Senden von Daten über UART1 DMA Cannel 1. Ich Sende ein Telegramm mit 48 Byte's in drei Blöcken zu je 16 Byte. Die Blöcke 1 und 2 werden problemlos übertragen aber beim Block 3 werden nur 14 Byte gesendet. Komischerweise hat es schon funktioniert das auch beim dritten Block alle 16 Byte übertragen wurden. Im DMA-Puffer stehen alle 16 Byte. Wenn ich beim Block drei mitschaue ist die Variable 'ucDataSize' mit 16 beschrieben. Wenn ich nur 1 reinschreibe dann wird auch nur 1 Byte übertragen. Ich bin ratlos, hat jemand eine Idee. Bitte Danke. void vWriteDmaPb(unsigned char ucDataSize){ /******************************************************************* erstellt am : 22.06.2012 Funktionsname: vWriteDmaPb Beschreibung: Diese Function schreibt über den DMA auf die UART1 zum Peripheriebus. PARAMETER: letzte Änderung: ******************************************************************/ DmaChannel chn=DMA_CHANNEL1; // DMA channel to use for our example ucModePb=1; //Mode schreiben DmaChnOpen(chn, DMA_CHN_PRI1, DMA_OPEN_MATCH); // reconfigure the channel // set the events: now the start event is the UART tx being empty // we maintain the pattern match mode DmaChnSetEventControl(chn, DMA_EV_START_IRQ_EN|DMA_EV_MATCH_EN|DMA_EV_START_IRQ(_UART1_TX_IRQ)); // set the transfer source and dest addresses, source and dest size and cell size DmaChnSetTxfer(chn, ucDmaBuffPb, (void*)&U1TXREG, ucDataSize, 1, 1); DmaChnSetEvEnableFlags(chn, DMA_EV_BLOCK_DONE); // enable the transfer done interrupt: pattern match or all the characters transferred INTEnable(INT_SOURCE_DMA(chn), INT_ENABLED); // enable the chn interrupt in the INT controller DmaChnStartTxfer(chn, DMA_WAIT_NOT, 0); // force the DMA transfer: the UART1 tx flag it's already been active } //vWriteDmaPb