باسلام خدمت اساتید
مشکلی دارم خیلی بزرگ در حال راه اندازی dma بر روی uart0 هستم تکه کدی نوشتم که خروجی میدهاما درست خروجی نمیده آیا کسی هست که دست مارو بگیره مشکلمون حل شه
#include <nxp/iolpc1768.h>
#include <stdio.h>
#include "gpio1768.h"
unsigned char h[]="1";
//unsigned char a[]="2222";
void uart_init(unsigned short baud)
{
unsigned short div; //PCONP |= 0x20210048 ;
CLKOUTCFG = 0;
div = (unsigned short)(10000000/(baud*16L));
U0LCR = 0x83;
U0DLL = (div);
U0DLM = (div>>8);
U0LCR &= ~(1<<7);
PINSEL0 |= (1<<4);
U0FCR = 0x87; /* Enable and reset TX and RX FIFO. */
//U0FCR |= 0x87;
delay(5000);
while( (U1LSR & (1<<5))== 0);
}
void dmacon(void)
{
static unsigned char b[]="10";
U0FCR = 0x87;
PCONP = 0xffffffff;
CCLKCFG = 0;
PCONP |=(1<<29);
DMACCONFIGURATION = 0x00000003;
DMACC0CONFIGURATION = 0x00000001;
DMACINTTCCLEAR = 0xff ; //clear all interrupts
DMACINTERRCLR = 0xff; //eclear interrupt errors
DMACC0SRCADDR = ( unsigned int ) &b;
DMACC0DESTADDR = ( unsigned int ) &U0THR;
//DMACC0LLI |= (((unsigned int )&b)<<2);
DMACC0CONTROL = sizeof(b);
DMACC0CONTROL |= (0<<12);
DMACC0CONFIGURATION |= (1<<0);
DMACC0CONFIGURATION |= (1000<<6);
DMACC0CONFIGURATION |= (1<<11);
DMACC0CONFIGURATION |= 0x00000001;
//delay(50000);
}
// PLL INIT
void pllinit (void)
{
//((FCCO = (2 × M × FIN) / N))
//"M" is bit of 14:0 PLL0CFG and "N" is bit of 23:16
SCS = (0x00000001 << 5); //Enable Main Oscillator
SCS |= 0x00000020; //Select the main Oscillator range
PLL0CON &= ~0x01; //Disconnect the PLL
PLL0FEED = 0xAA;
PLL0FEED = 0x55;
PLL0CON &= ~0x01; //Disconnect the PLL
PLL0FEED = 0xAA;
PLL0FEED = 0x55; //Write feed sequence
while(!(SCS & 0x00000040)); //Wait untill Main Oscillator is stable
CLKSRCSEL = 0x00000001; //Select Main Oscillator as PLL Imput
PLL0CFG = (0x000000A|0x00020000); //Write PLL Multipiler and Divider values
PLL0FEED = 0xAA;
PLL0FEED = 0x55; //Write Feed Sequence
PLL0CON = 0x01; //Enable PLL
PLL0FEED = 0xAA;
PLL0FEED = 0x55; //Wriete Feed Sequence
USBCLKCFG = 0x00000009; //Write USBSEL Divider value
CCLKCFG = 0x00000008; //Write CPU Divider Value
while(PLL0STAT & 0x000); //Wait PLL for Lock
PLL0CON |= 0x02; //Connect the PLL
PLL0FEED = 0xAA;
PLL0FEED = 0x55;
}
void main()
{
pllinit();
U0TER = 0x80;
U0FCR = 0x1;
U0FCR = 0x87;
//dir0(24);
//set0(24) ;
PCLKSEL0 |=(1<<6); //pish taghsim konanad e PCLK
delay(10000);
uart_init(9600);
//delay(500);
//delay(500);
//U0THR = '0';
//U0THR = '1';
//U0THR = '2';
//U0THR = '3';
//U0THR = '4';
//U0FCR |=(1<<0);
//U0FCR |=(1<<1);
U0TER |= 0x80;
//U0THR = '0';
//delay(1000) ;
//dmacon();
//delay(1000000) ;
while (1)
{
delay(2);
while( (U1LSR & (1<<5))== 0);
//uart_init(9600);
//U0TER = 0x80;
//U0THR = 's';
dmacon();
delay(10000) ;
}
}