• AVR Freaks

AnsweredHot!DMA Force transfer issue

Author
BHUSHAN
Starting Member
  • Total Posts : 53
  • Reward points : 0
  • Joined: 2019/02/04 23:17:18
  • Location: 0
  • Status: offline
2019/06/11 23:09:16 (permalink)
0

DMA Force transfer issue

Hi 2 all.
I am using PIC32MX795F512L. In this project I am enabling DMA module and forcing a transfer from buffer(located in RAM memory) to UART2 TX register. What I am not getting is that instead of transferring 20 bytes DMA is transferring only 9 bytes(all the time). I have tried changing UART2 Tx interrupt settings(using UTXISEL bits) and DMA destination cell transfer register (DCH0CSIZ) but nothing worked. What conceptual thing I am missing?
My code :-
 
/* Pragma settings for Fosc=80MHz and PBClk=80MHZ with external oscillator and Watchdog Off*/
#pragma config FPLLMUL =MUL_20
#pragma config FPLLIDIV = DIV_2
#pragma config FPLLODIV = DIV_1, FWDTEN = OFF
#pragma config POSCMOD = XT, FNOSC = PRIPLL
#pragma config FPBDIV = DIV_1


/* Translate a kernel virtual address in KSEG0 or KSEG1 to a real physical address and back.*/
typedef unsigned long _paddr_t; /* a physical address */
typedef unsigned long _vaddr_t; /* a virtual address */


#define KVAd_TO_PAd(v)      ((_paddr_t)(v) & 0x1fffffff)
#define PAd_TO_KVAd0(pa)    ((void *) ((pa) | 0x80000000))
#define PAd_TO_KVAd1(pa)    ((void *) ((pa) | 0xa0000000))

void UART_init()
{
  U2MODEbits.ON = 0;//initially turn-off the module
  U2BRG = 88;//56kbps at 80MHz
  U2MODEbits.SIDL = 0;//Continue operation in ideal mode   U2MODEbits.IREN = 0;//disable IrDA
  U2MODEbits.UEN0 = 0; //UxTX and UxRX pins are enabled
  U2MODEbits.UEN1 = 0;
  U2MODEbits.WAKE = 0;//Disable Wake-up on Start bit Detect During Sleep Mode bit
  U2MODEbits.LPBACK = 0;//Disable loop back
  U2MODEbits.ABAUD = 0;//Disable auto-baud
  U2MODEbits.RXINV = 0;//UxRX Idle state is ?1?
  U2MODEbits.BRGH = 0;//Standard Speed mode ? 16x baud clock enabled
  U2MODEbits.PDSEL0 = 0;//8-bit data, no parity
  U2MODEbits.PDSEL1 = 0;
  U2MODEbits.STSEL = 0;//1 Stop bit
  U2STAbits.ADM_EN = 0;//Automatic Address Detect mode is disabled
  U2STAbits.UTXINV = 0;//UxTX Idle state is ?1?
  U2STAbits.UTXBRK = 0;//Break transmission is disabled or completed
  U2STAbits.UTXEN = 1;//UARTx transmitter is enabled
  U2STAbits.ADDEN = 0;//Address Detect mode is disabled
  U2STAbits.URXEN = 1;//UARTx receiver is enabled
  INTCONbits.MVEC = 1;
  U2STAbits.URXISEL = 0;//Interrupt flag bit is asserted while receive buffer is not empty (has at least 1 data character)
  U2STAbits.URXISEL1 = 0;
  U2STAbits.UTXISEL0 = 0;//Interrupt is generated and asserted while the transmit buffer contains at least one empty space
  U2STAbits.UTXISEL1 = 0;
   U2MODEbits.ON = 1;
}

void main() {
 unsigned char count,i;
 unsigned char flashBuff[20]={'1','2','3','4','5','6','7','8','9','0','a','b','c','d','e','f','g','h','i','j'} ;
 UART_init();
IEC1CLR=0x00010000; // disable DMA channel 0 interrupts
IFS1CLR=0x00010000; // clear existing DMA channel 0 interrupt flag
DMACONSET=0x00008000; // enable the DMA controller
DCH0CON=0x3; // channel off, priority 3, no chaining
DCH0ECON=0; // no start or stop IRQs, no pattern match
// program the transfer
DCH0SSA=KVAd_TO_PAd(flashBuff); // transfer source physical address
DCH0DSA=KVAd_TO_PAd(&U2TXREG); // transfer destination physical address
DCH0SSIZ=20; // source size 20bytes
DCH0DSIZ= 1; // destination size 1 bytes
DCH0CSIZ=20; // 20 bytes transferred per event
DCH0INTCLR=0x00ff00ff; // clear existing events, disable all interrupts
DCH0CONSET=0x80; // turn channel on
/*random delay generation*/
 for(count=0;count<250;count++)
 for(i=0;i<250;i++);
DCH0ECONSET=0x00000080; // set CFORCE to 1
while(1);
}


#1
Larry.Standage
Super Member
  • Total Posts : 901
  • Reward points : 0
  • Joined: 2011/12/30 09:50:47
  • Location: 0
  • Status: offline
Re: DMA Force transfer issue 2019/06/11 23:29:19 (permalink) ☄ Helpfulby BHUSHAN 2019/06/12 01:43:58
0
That number, 9, is significant. It happens to be the size of the UART transmit buffer (8), plus one for the data that would be on the way out. But if you happen to write more data to the UART transmit buffer than it can handle, that data is lost.
 
So you're not going to be able to have the DMA just write 20 bytes to the UART, and expect it all to be picked up. The UART has to tell the DMA that it can accept new data. That's the purpose of using the interrupts to trigger DMA transfers.
 
Look at the UART transmit interrupt (where it can signal that it has at least one byte of space available), and use that to trigger the DMA. Only one byte would be transferable at a time (cell size), but you won't overflow the buffer.
 
By the way, your flashBuff array will not be in flash, but on the stack. Move it outside of main, and declare it const.
#2
ric
Super Member
  • Total Posts : 22647
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: DMA Force transfer issue 2019/06/11 23:40:44 (permalink)
0
I've never used this chip, and may be way off the mark, but shouldn't
DCH0CSIZ=20; // 20 bytes transferred per event
be
DCH0CSIZ=1; // 1 byte transferred per event

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#3
BHUSHAN
Starting Member
  • Total Posts : 53
  • Reward points : 0
  • Joined: 2019/02/04 23:17:18
  • Location: 0
  • Status: offline
Re: DMA Force transfer issue 2019/06/12 22:51:12 (permalink)
0
Larry.Standage
That number, 9, is significant. It happens to be the size of the UART transmit buffer (8), plus one for the data that would be on the way out. But if you happen to write more data to the UART transmit buffer than it can handle, that data is lost.
 
So you're not going to be able to have the DMA just write 20 bytes to the UART, and expect it all to be picked up. The UART has to tell the DMA that it can accept new data. That's the purpose of using the interrupts to trigger DMA transfers.
 
Look at the UART transmit interrupt (where it can signal that it has at least one byte of space available), and use that to trigger the DMA. Only one byte would be transferable at a time (cell size), but you won't overflow the buffer.
 
By the way, your flashBuff array will not be in flash, but on the stack. Move it outside of main, and declare it const.




Hello Larry,
Actually array named flashBuff will be in stack (name is deceptive, I copied the code from one of previous code.Don't care about it). After reading your comment ,I studied DMA again. Here are some concluding points that I got after reading your comment and DMA notes. Kindly, look at them:-
(1) The UART TX interrupt will inform DMA module(using interrupt flags), when it can accept the byte data.
     That means I have to set UART TX interrupt using UTXISEL
     UTXISEL<1:0>: TX Interrupt Mode Selection bits
     11 = Reserved, do not use
     10 = Interrupt is generated and asserted while the transmit buffer is empty
     01 = Interrupt is generated and asserted when all characters have been transmitted
     00 = Interrupt is generated and asserted while the transmit buffer contains at least one empty space
  
   According to your statement "Look at the UART transmit interrupt (where it can signal that it has at least    one byte of space available), and use that to trigger the DMA" I configured UTXISEL as 00.
(2) Also according to your statement "Only one byte would be transferable at a time (cell size), but you won't overflow the buffer" I configured cell size as 1(DCH0CSIZ=1).
(3)So whenever there is an space of 1 byte in TX buffer(UTXISEL = 0), UART2 module will raise an interrupt and DMA module will transfer 1 byte(cell size) to UTXREG(UART TX Register). This operation will continue untill all the source size (here 20 bytes) get transferred.
 
According to above points I wrote this code(keeping configuration settings according to previous one):-
 
typedef unsigned long _paddr_t; /* a physical address */
typedef unsigned long _vaddr_t; /* a virtual address */

/*
 * Translate a kernel virtual address in KSEG0 or KSEG1 to a real
 * physical address and back.
 */
#define KVAd_TO_PAd(v)      ((_paddr_t)(v) & 0x1fffffff)
#define PAd_TO_KVAd0(pa)    ((void *) ((pa) | 0x80000000))
#define PAd_TO_KVAd1(pa)    ((void *) ((pa) | 0xa0000000))

void UART_init()
{
  U2MODEbits.ON = 0;//initially turn-off the module
  U2BRG = 88;//56kbps at 80MHz
  U2MODEbits.SIDL = 0;//Continue operation in ideal mode   U2MODEbits.IREN = 0;//disable IrDA
  U2MODEbits.UEN0 = 0; //UxTX and UxRX pins are enabled
  U2MODEbits.UEN1 = 0;
  U2MODEbits.WAKE = 0;//Disable Wake-up on Start bit Detect During Sleep Mode bit
  U2MODEbits.LPBACK = 0;//Disable loop back
  U2MODEbits.ABAUD = 0;//Disable auto-baud
  U2MODEbits.RXINV = 0;//UxRX Idle state is ?1?
  U2MODEbits.BRGH = 0;//Standard Speed mode ? 16x baud clock enabled
  U2MODEbits.PDSEL0 = 0;//8-bit data, no parity
  U2MODEbits.PDSEL1 = 0;
  U2MODEbits.STSEL = 0;//1 Stop bit
  U2STAbits.ADM_EN = 0;//Automatic Address Detect mode is disabled
  U2STAbits.UTXINV = 0;//UxTX Idle state is ?1?
  U2STAbits.UTXBRK = 0;//Break transmission is disabled or completed
  U2STAbits.UTXEN = 1;//UARTx transmitter is enabled
  U2STAbits.ADDEN = 0;//Address Detect mode is disabled
  U2STAbits.URXEN = 1;//UARTx receiver is enabled
  U2STAbits.UTXISEL = 0;//as discussed previously                         
   U2MODEbits.ON = 1;
}

void main() {
 unsigned char count,i;
 unsigned char flashBuff[20]={'1','2','3','4','5','6','7','8','9','0','a','b','c','d','e','f','g','h','i','j'};
 UART_init();
IEC1CLR=0x00010000; // disable DMA channel 0 interrupts
IFS1CLR=0x00010000; // clear existing DMA channel 0 interrupt flag
DMACONSET=0x00008000; // enable the DMA controller
DCH0CON=0x3; // channel off, priority 3, no chaining
DCH0ECON=0; // no start or stop IRQs, no pattern match

DCH0SSA=KVAd_TO_PAd(flashBuff); // transfer source physical address
DCH0DSA=KVAd_TO_PAd(&U2TXREG); // transfer destination physical address
DCH0SSIZ=20; // source size 200 bytes
DCH0DSIZ= 1; // destination size 1 bytes
DCH0CSIZ=1; // 1 bytes transferred per event

DCH0INTCLR=0x00ff00ff; // clear existing events, disable all interrupts
DCH0CONSET=0x80; // turn channel on
for(count=0;count<20;count++); //random delay
 DCH0ECONSET=0x00000080; // set CFORCE to 1 that is block transfer start
 while(1);//wait here infinitely
}
 
Problem is now that only 1 byte is getting transferred (first one). Why so?


#4
jg_ee
Super Member
  • Total Posts : 148
  • Reward points : 0
  • Joined: 2015/04/30 10:54:52
  • Location: Colorado
  • Status: offline
Re: DMA Force transfer issue 2019/06/14 06:50:54 (permalink)
0
You need to set up the uart tx vector to trigger subsequent transfers, in DCH0ECON.
#5
Larry.Standage
Super Member
  • Total Posts : 901
  • Reward points : 0
  • Joined: 2011/12/30 09:50:47
  • Location: 0
  • Status: offline
Re: DMA Force transfer issue 2019/06/14 12:14:24 (permalink)
0
jg_ee has is right. This is the line for setting up DCH0ECON:
DCH0ECON = (39 << 8) | 0x10;

39 is the IRQ for UART2 TX interrupts. The 0x10 is for enabling the IRQ to trigger a start transfer.
 
With that, I was able to get all 20 bytes to transfer, and it stopped after it was done.
#6
BHUSHAN
Starting Member
  • Total Posts : 53
  • Reward points : 0
  • Joined: 2019/02/04 23:17:18
  • Location: 0
  • Status: offline
Re: DMA Force transfer issue 2019/06/14 22:44:18 (permalink)
0
Larry.Standage
jg_ee has is right. This is the line for setting up DCH0ECON:
DCH0ECON = (39 << 8) | 0x10;

39 is the IRQ for UART2 TX interrupts. The 0x10 is for enabling the IRQ to trigger a start transfer.
 
With that, I was able to get all 20 bytes to transfer, and it stopped after it was done.




 
I appreciate you all for giving your precious time for helping me. Thanks.
Following is my new code which I wrote after seeing your suggestions:-
 
typedef unsigned long _paddr_t; /* a physical address */
typedef unsigned long _vaddr_t; /* a virtual address */

/*
 * Translate a kernel virtual address in KSEG0 or KSEG1 to a real
 * physical address and back.
 */
#define KVAd_TO_PAd(v)      ((_paddr_t)(v) & 0x1fffffff)
#define PAd_TO_KVAd0(pa)    ((void *) ((pa) | 0x80000000))
#define PAd_TO_KVAd1(pa)    ((void *) ((pa) | 0xa0000000))

void UART_init()
{
  U2MODEbits.ON = 0;//initially turn-off the module
  U2BRG = 88;//56kbps at 80MHz
  U2MODEbits.SIDL = 0;//Continue operation in ideal mode   U2MODEbits.IREN = 0;//disable IrDA
  U2MODEbits.UEN0 = 0; //UxTX and UxRX pins are enabled
  U2MODEbits.UEN1 = 0;
  U2MODEbits.WAKE = 0;//Disable Wake-up on Start bit Detect During Sleep Mode bit
  U2MODEbits.LPBACK = 0;//Disable loop back
  U2MODEbits.ABAUD = 0;//Disable auto-baud
  U2MODEbits.RXINV = 0;//UxRX Idle state is ?1?
  U2MODEbits.BRGH = 0;//Standard Speed mode ? 16x baud clock enabled
  U2MODEbits.PDSEL0 = 0;//8-bit data, no parity
  U2MODEbits.PDSEL1 = 0;
  U2MODEbits.STSEL = 0;//1 Stop bit
  U2STAbits.ADM_EN = 0;//Automatic Address Detect mode is disabled
  U2STAbits.UTXINV = 0;//UxTX Idle state is ?1?
  U2STAbits.UTXBRK = 0;//Break transmission is disabled or completed
  U2STAbits.UTXEN = 1;//UARTx transmitter is enabled
  U2STAbits.ADDEN = 0;//Address Detect mode is disabled
  U2STAbits.URXEN = 1;//UARTx receiver is enabled
  U2STAbits.UTXISEL = 0;//as discussed previously
   U2MODEbits.ON = 1;
}

void main() {
 unsigned char count,i;
 unsigned char flashBuff[20]={'1','2','3','4','5','6','7','8','9','0','a','b','c','d','e','f','g','h','i','j'};
 UART_init();
IEC1CLR=0x00010000; // disable DMA channel 0 interrupts
IFS1CLR=0x00010000; // clear existing DMA channel 0 interrupt flag
DMACONSET=0x00008000; // enable the DMA controller
DCH0CON=0x3; // channel off, priority 3, no chaining
//DCH0ECON=0; // no start or stop IRQs, no pattern match
DCH0ECON = (39 << 8) | 0x10; //As suggested by Larry
DCH0SSA=KVAd_TO_PAd(flashBuff); // transfer source physical address
DCH0DSA=KVAd_TO_PAd(&U2TXREG); // transfer destination physical address
DCH0SSIZ=20; // source size 20bytes
DCH0DSIZ= 1; // destination size 1 bytes
DCH0CSIZ=1; // 1 bytes transferred per event

DCH0INTCLR=0x00ff00ff; // clear existing events, disable all interrupts
DCH0CONSET=0x80; // turn channel on
for(count=0;count<20;count++); //random delay
 DCH0ECONSET=0x00000080; // set CFORCE to 1 that is block transfer start
 while(1);//wait here infinitely
}
 
I am viewing the output in serial terminal. Now also only '1' is getting transferred. How you got the output man ? Did you use the same code as above or you made some changes? Kindly suggest.
#7
Larry.Standage
Super Member
  • Total Posts : 901
  • Reward points : 0
  • Joined: 2011/12/30 09:50:47
  • Location: 0
  • Status: offline
Re: DMA Force transfer issue 2019/06/16 15:51:30 (permalink) ☄ Helpfulby BHUSHAN 2019/06/16 21:24:19
0
Here's my code. I used UART 1 for my communications, because I was using a different board. You'll see differences related to that, but everything else was pretty much the same except that one added line for the DCH0EINT.
 
#8
BHUSHAN
Starting Member
  • Total Posts : 53
  • Reward points : 0
  • Joined: 2019/02/04 23:17:18
  • Location: 0
  • Status: offline
Re: DMA Force transfer issue 2019/06/16 23:47:20 (permalink)
0
Larry.Standage
Here's my code. I used UART 1 for my communications, because I was using a different board. You'll see differences related to that, but everything else was pretty much the same except that one added line for the DCH0EINT.
 




 
Thanks for your efforts. I am not able to use UART1 on my board so I made changes to your code according to UART2. In your code you have commented this line "DCH0ECONSET = 0x00000010; // set CFORCE to 1" but if I don't use this instruction(ie force transfer) then no character will be transferred. However if I use force bit then only 1 character is getting transferred. Following is my code:-(for PIC32MX795F512L)
 
/* Pragma settings for Fosc=80MHz and PBClk=80MHZ with external oscillator and Watchdog Off*/
#pragma config FPLLMUL =MUL_20
#pragma config FPLLIDIV = DIV_2
#pragma config FPLLODIV = DIV_1, FWDTEN = OFF
#pragma config POSCMOD = XT, FNOSC = PRIPLL
#pragma config FPBDIV = DIV_1
#pragma config ICESEL = ICS_PGx2

#include <xc.h>
#include <sys/attribs.h>
#include <sys/kmem.h>

/* Translate a kernel virtual address in KSEG0 or KSEG1 to a real physical address and back.*/
typedef unsigned long _paddr_t; /* a physical address */
typedef unsigned long _vaddr_t; /* a virtual address */


#define KVAd_TO_PAd(v)      ((_paddr_t)(v) & 0x1fffffff)
#define PAd_TO_KVAd0(pa)    ((void *) ((pa) | 0x80000000))
#define PAd_TO_KVAd1(pa)    ((void *) ((pa) | 0xa0000000))

void UART_init() {
    U2MODEbits.ON = 0; //initially turn-off the module
    U2BRG = 88; //56kbps at 80MHz
    U2MODEbits.SIDL = 0; //Continue operation in ideal mode   U2MODEbits.IREN = 0;//disable IrDA
    U2MODEbits.UEN0 = 0; //UxTX and UxRX pins are enabled
    U2MODEbits.UEN1 = 0;
    U2MODEbits.WAKE = 0; //Disable Wake-up on Start bit Detect During Sleep Mode bit
    U2MODEbits.LPBACK = 0; //Disable loop back
    U2MODEbits.ABAUD = 0; //Disable auto-baud
    U2MODEbits.RXINV = 0; //UxRX Idle state is ?1?
    U2MODEbits.BRGH = 0; //Standard Speed mode ? 16x baud clock enabled
    U2MODEbits.PDSEL0 = 0; //8-bit data, no parity
    U2MODEbits.PDSEL1 = 0;
    U2MODEbits.STSEL = 0; //1 Stop bit
    U2STAbits.ADM_EN = 0; //Automatic Address Detect mode is disabled
    U2STAbits.UTXINV = 0; //UxTX Idle state is ?1?
    U2STAbits.UTXBRK = 0; //Break transmission is disabled or completed
    U2STAbits.UTXEN = 1; //UARTx transmitter is enabled
    U2STAbits.ADDEN = 0; //Address Detect mode is disabled
    U2STAbits.URXEN = 1; //UARTx receiver is enabled
    INTCONbits.MVEC = 1;
    U2STAbits.URXISEL = 0; //Interrupt flag bit is asserted while receive buffer is not empty (has at least 1 data character)
    U2STAbits.URXISEL1 = 0;
    U2STAbits.UTXISEL0 = 0; //Interrupt is generated and asserted while the transmit buffer contains at least one empty space
    U2STAbits.UTXISEL1 = 0;
    U2MODEbits.ON = 1;
}

void main() {
    unsigned char count, i;
    unsigned char flashBuff[20] = {'1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'};
    UART_init();
    LATB = 0;
    TRISB = 0;
    IEC1CLR = 0x00010000; // disable DMA channel 0 interrupts
    IFS1CLR = 0x00010000; // clear existing DMA channel 0 interrupt flag
    DMACONSET = 0x00008000; // enable the DMA controller
    DCH0CON = 0x3; // channel off, priority 3, no chaining
    DCH0ECON = (39 << 8) | 0x10; // Start on UART 2 TX interrupt
    // program the transfer
    DCH0SSA = KVA_TO_PA(flashBuff); // transfer source physical address
    DCH0DSA = KVA_TO_PA(&U2TXREG); // transfer destination physical address
    DCH0SSIZ = 20; // source size 20bytes
    DCH0DSIZ = 1; // destination size 1 bytes
    DCH0CSIZ = 1; // 1 bytes transferred per event
    DCH0INTCLR = 0x00ff00ff; // clear existing events, disable all interrupts
     
    DCH0CONSET = 0x80;// | (1 << 6); // turn channel on
    /*random delay generation*/
    for (count = 0; count < 250; count++)
        for (i = 0; i < 250; i++);
    //   DCH0ECONSET=0x00000080; //if commented then no character will be transferred
        while (1) {
        if (IFS1bits.U2TXIF) {
          // U2TXREG = '7';
           // LATB= 0xff;
    //    } else {
    //        LATB = 0x77 ;
    //   }
    }
   //     U2TXREG = 'X';
  //  DCH0ECONSET = 0x00000080; // set CFORCE to 1  
}
 
My observations:-
(1) When CFORCE bit not set, no character will get transferred. When set, only 1 character getting              transferred
(2) Whatever be the condition for UART TX interrupt flag generation (that is, U2STAbits.UTXISEL0 
    U2STAbits.UTXISEL1 bits values can be 00,01 or 10) has no effect on the output. U2TXIF is always high for any value of UTXISEL.
Why I am not getting the output?
post edited by BHUSHAN - 2019/06/17 02:07:49
#9
Larry.Standage
Super Member
  • Total Posts : 901
  • Reward points : 0
  • Joined: 2011/12/30 09:50:47
  • Location: 0
  • Status: offline
Re: DMA Force transfer issue 2019/06/17 13:55:11 (permalink) ☼ Best Answerby BHUSHAN 2019/06/17 22:21:44
5 (3)
I'm not sure why, but the data sheet lists the UART2 TX interrupt as being IRQ 39, but I was only able to get it working with UART2 by using UART3's TX interrupt, 42. (Okay, so that's the answer to life, the universe and everything!)
 
Unfortunately, I don't have enough bandwidth to figure out why the documentation is off, but try
DCH0ECON = (42 << 8) | 0x10;

You shouldn't need to force the transfer. Once you make the channel active in the DCH0CON register, the interrupt (which is already active) should start the transfer.
#10
BHUSHAN
Starting Member
  • Total Posts : 53
  • Reward points : 0
  • Joined: 2019/02/04 23:17:18
  • Location: 0
  • Status: offline
Re: DMA Force transfer issue 2019/06/17 22:28:31 (permalink)
0
Larry.Standage
I'm not sure why, but the data sheet lists the UART2 TX interrupt as being IRQ 39, but I was only able to get it working with UART2 by using UART3's TX interrupt, 42. (Okay, so that's the answer to life, the universe and everything!)
 
Unfortunately, I don't have enough bandwidth to figure out why the documentation is off, but try
DCH0ECON = (42 << 8) | 0x10;

You shouldn't need to force the transfer. Once you make the channel active in the DCH0CON register, the interrupt (which is already active) should start the transfer.




 
It worked!, Man. Thanks for your persistent help. Highly obliged.
Last thing I want to ask that how you figured it out that UART2 TX interrupt will work by using UART3's TX interrupt(  I heavily depend on datasheets, but now on wards even they are going under scanner  )?
 
   Stay happy and blessed (Okay, so that's the answer to life, the universe and everything!).
#11
Larry.Standage
Super Member
  • Total Posts : 901
  • Reward points : 0
  • Joined: 2011/12/30 09:50:47
  • Location: 0
  • Status: offline
Re: DMA Force transfer issue 2019/06/18 09:05:22 (permalink)
0
What was bugging me as I worked on it was that the flag in IFS1 was in the wrong place. The debugger was showing that bit 10 was high, even though that wasn't supposed to be the UART the code turned on. That's the flag for UART 3, so I switched the IRQ and bingo!
 
I happen to be the one that revised the data sheet to rev J, but there was a change in how the UARTs were referenced. I dug up rev G, and it named them rather interestingly. The UART 2 TX interrupt is at IRQ 42, but it's labeled "U2TX - UART3A Transmitter". I'll have to send a note to the guys who are maintaining the data sheets now.
 
Happy to help. Amen and Amen!
 
#12
BHUSHAN
Starting Member
  • Total Posts : 53
  • Reward points : 0
  • Joined: 2019/02/04 23:17:18
  • Location: 0
  • Status: offline
Re: DMA Force transfer issue 2019/06/20 05:18:22 (permalink)
0
Larry.Standage
What was bugging me as I worked on it was that the flag in IFS1 was in the wrong place. The debugger was showing that bit 10 was high, even though that wasn't supposed to be the UART the code turned on. That's the flag for UART 3, so I switched the IRQ and bingo!
 
I happen to be the one that revised the data sheet to rev J, but there was a change in how the UARTs were referenced. I dug up rev G, and it named them rather interestingly. The UART 2 TX interrupt is at IRQ 42, but it's labeled "U2TX - UART3A Transmitter". I'll have to send a note to the guys who are maintaining the data sheets now.
 
Happy to help. Amen and Amen!
 




Kudos to you man.
Enjoy and thanks for the help.
#13
Jump to:
© 2019 APG vNext Commercial Version 4.5