This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello,
In the following program (below), I'm trying to work with the DMA triggered by DMAREQ. For some reason the program does not work.
I mean, even though I work in the form of block transfer, the information sent is just the first letter 'H' from the string of "Hello world".
One. Is there anyone that identifies what the problem is?
Two. Is there someone who can present a program that works with DMAREQ relative to block transfer of data
I'd appreciate very much all help in understanding the problem.
======== The program start from here ==========================================
#include <msp430.h>
#include <string.h>// for strlen();
const char String[] = "Hello World\r\n";
extern void ClockCnfg (void);
extern void TimerA1Cnfg (void);
extern void PortCnfg ( void );
extern void CommCnfg(void);
void DmaCnfg (void);
int main(void)
{
__bic_SR_register(GIE); // disable interrupt.
PortCnfg();
ClockCnfg();// 16mhz
TimerA1Cnfg();//timer interrupt of 10Hz.and blink the led
CommCnfg(); // Initialize the communication.57600 BR.
DmaCnfg();
__bis_SR_register(GIE); // enable interrupts
while(1)
{
DMA0CTL |= DMAEN;// DMA enable.
DMA0CTL |= DMAREQ;// trigger.
__delay_cycles(65000);// need the delay , else the printing
// would no be proper.
while ((DMA0CTL & DMAEN) != 0)// wait here, the DMAEN clear after the
// completion of the block transfer. and must be set again before a
// another block transfer can be trigger .
{
__no_operation();// Required only for debugger
}
}
}
void DmaCnfg (void) {
//DMA configuration.
DMA0CTL &= ~DMAEN;
/* DMAxTSEL bits should be modified only
* when the DMACTLx DMAEN bit is 0
*/
DMACTL0 = DMA0TSEL_0;// A transfer is triggered when the DMAREQ bit is set
// Source block address
__data16_write_addr((unsigned short) &DMA0SA,(unsigned long) String);
// Destination single address
__data16_write_addr((unsigned short) &DMA0DA,(unsigned long) &UCA0TXBUF);
DMA0SZ = strlen(String); // Block size
DMA0CTL |= (
DMADT_1/*block transfer*/
//DMADT_2 /* Burst-Block transfer */
+DMASRCINCR_3 /* Source address is incremented */
+DMASBDB /* DMA source byte.
* This bit selects the source as a byte or word.
**/
+DMALEVEL
/*DMA level. This bit selects between edge-sensitive
* and level-sensitive triggers.
* 1b = Level sensitive (high level) */
);
}
=============================== end of the program ===============================
**Attention** This is a public forum