Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: dbgu printing wrong char for PCK 133Mhz
PostPosted: Tue Mar 29, 2011 8:21 am 
Offline

Joined: Fri Mar 12, 2010 6:27 am
Posts: 6
Hi,

I have a strange issue,

1 .DBGU init below works fine when MCK - 100352000 and PCK -200704000 , pUSART->US_BRGR = 54
2. but for my project I need to set PCK to 133120000 so as MCK 66560000, pUSART->US_BRGR = 36. With these settings characters on hyperterminal are wrong.

DBGU Init code -
unsigned int dwMasterClock;
AT91PS_USART pUSART = (AT91PS_USART) AT91C_BASE_DBGU;
AT91PS_PDC pPDC = (AT91PS_PDC) &(pUSART->US_RPR);
AT91PS_PIO pPioB = (AT91PS_PIO) AT91C_BASE_PIOB;

dwMasterClock = mck;

//
// Init the DBGU
//
// Configure PIO controllers to periph mode
pPioB->PIO_ASR = AT91C_PB14_DRXD | AT91C_PB15_DTXD ;
pPioB->PIO_PDR = AT91C_PB14_DRXD | AT91C_PB15_DTXD ;


//Configure USART
// Disable interrupts
pUSART->US_IDR = (unsigned int) -1;

// Reset receiver and transmitter
pUSART->US_CR = AT91C_US_RSTRX | AT91C_US_RSTTX | AT91C_US_RXDIS | AT91C_US_TXDIS ;

// Define the baud rate divisor register
{
unsigned int baud_value = ((dwMasterClock*10)/(baudrate * 16));
if ((baud_value % 10) >= 5)
baud_value = (baud_value / 10) + 1;
else
baud_value /= 10;
pUSART->US_BRGR = baud_value;
}

// Write the Timeguard Register
pUSART->US_TTGR = 0;

// Clear Transmit and Receive Counters

// Disable the RX and TX PDC transfer requests
pPDC->PDC_PTCR = AT91C_PDC_RXTDIS;
pPDC->PDC_PTCR = AT91C_PDC_TXTDIS;

// Reset all Counter register Next buffer first
pPDC->PDC_TNPR = 0;
pPDC->PDC_TNCR = 0;
pPDC->PDC_RPR = 0;
pPDC->PDC_RCR = 0;
pPDC->PDC_RPR = 0;
pPDC->PDC_RCR = 0;
pPDC->PDC_TPR = 0;
pPDC->PDC_TCR = 0;

// Enable the RX and TX PDC transfer requests
pPDC->PDC_PTCR = AT91C_PDC_RXTEN;
pPDC->PDC_PTCR = AT91C_PDC_TXTEN;

// Define the USART mode
pUSART->US_MR = AT91C_US_ASYNC_MODE;

// Enable Transmitter
pUSART->US_CR = AT91C_US_RXEN;
pUSART->US_CR = AT91C_US_TXEN;


Any clue to solve the issue will be very helpful. Thanks in advance.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: