Sign in

username:

password:



Not a member?

Search adsp



Search tips

Subscribe to adsp



adsp by Keywords

AD1819 | AD7332 | ADSP-2106 | ADSP-21060 | ADSP-21065L | ADSP-2116 | ADSP-21160M | ADSP-2181 | ADSP-218x | ADSP-219 | ADSP-2199 | ADSP219 | BF531 | BF532 | BF533 | BF535 | Blackfin | FFT | JTAG | LDF | SDRAM | SHARC | SPORT | UART | VDSP++ | VisualDSP

Ads

Discussion Groups

Discussion Groups | Analog Devices DSPs | Serial port(UART problem) for the new comer

Technical discussions related to Analog Devices DSPs (including Blackfin, TigerSHARC, SHARC and ADSP-21xx DSPs).

  

Post a new Thread

Serial port(UART problem) for the new comer - mall...@yahoo.co.in - Jul 26 8:44:46 2007



Actually, i want to tell clearly my problem so ,that iam elaborating...please read till
the end......... 
Actually i am configuring my system baud rate(RS232) t0 19200,8 data bits,1 stop bits,no
parity..... 

and based on the reset values...... 

MSEL[5:0]=0x0A; and for BF533 EZkit lite kit CLKIN=27Mhz.. 
so, VCO CLK is:0x0A*27=270MHz... 

and on the reset the SCEl=0x05 and DF=0; so,SCLK=VCO/5=54MHz......... 

Based on the formula Baud rate=SCLK/(16*divisor); 
19200=54*10^6/(16*divisor); 
i found divisor =176(APProximately); 

and the program is like this: 
i want to first configure serial port 19200,8,1,no 
so,UART_LCR=0x0083;//enabling DLAB to access DLL and DLH registers 
*pUART_DLL=0x00b0;// 176=b0; 
*pUART_DLH=0x0000; 
then making DLAB clear so,that i can access THR and RBR registers.. 

and i want to use polling here not the interrupts so, uam dissabling the interrupts... 
just i want to send @ to the BF533 then it will send 'B'.. 
After wards whatever i will send from system it has to return it.... 
#include<cdefBF533.h> 
//#include<ccblkfn.h> 

void serialin() 
{ 
*pUART_LCR=0x0083; 
*pUART_DLL=0x00b0; 
*pUART_DLH=0x0000; 
*pUART_LCR=0x0003; 
} 

void main() 

{ 

int a; 

serialin(); 

*pUART_GCTL=0x0001; 

*pUART_IER=0x0000; 

//polling for whether dat ready signal 
//is set or not 
while(((*pUART_LSR) & 0x0060) == 0x0060 ); 
if ((*pUART_RBR)==0x0040) 
{ 
*pUART_THR='B'; 
while(((*pUART_LSR) & 0x0040) == 0x0040 ); 

while(1) 
{ 
while(((*pUART_LSR) & 0x0060) == 0x0060 ); 
a=*pUART_RBR; 
*pUART_THR=a; 
while(((*pUART_LSR) & 0x0040) == 0x0040 ); 
} 

} 
}



(You need to be a member of adsp -- send a blank email to adsp-subscribe@yahoogroups.com )

Re: Serial port(UART problem) for the new comer - "gary.guo" - Jul 26 11:40:53 2007

And what's your problem?
--- In a...@yahoogroups.com, malli_1729@... wrote:
>
> Actually, i want to tell clearly my problem so ,that iam 
elaborating...please read till the end......... 
> Actually i am configuring my system baud rate(RS232) t0 19200,8 
data bits,1 stop bits,no parity..... 
> 
> and based on the reset values...... 
> 
> MSEL[5:0]=0x0A; and for BF533 EZkit lite kit CLKIN=27Mhz.. 
> so, VCO CLK is:0x0A*27=270MHz... 
> 
> and on the reset the SCEl=0x05 and DF=0; 
so,SCLK=VCO/5=54MHz......... 
> 
> Based on the formula Baud rate=SCLK/(16*divisor); 
> 19200=54*10^6/(16*divisor); 
> i found divisor =176(APProximately); 
> 
> and the program is like this: 
> i want to first configure serial port 19200,8,1,no 
> so,UART_LCR=0x0083;//enabling DLAB to access DLL and DLH registers 
> *pUART_DLL=0x00b0;// 176=b0; 
> *pUART_DLH=0x0000; 
> then making DLAB clear so,that i can access THR and RBR 
registers.. 
> 
> and i want to use polling here not the interrupts so, uam 
dissabling the interrupts... 
> just i want to send @ to the BF533 then it will send 'B'.. 
> After wards whatever i will send from system it has to return 
it.... 
> #include<cdefBF533.h> 
> //#include<ccblkfn.h> void serialin() 
> { 
> *pUART_LCR=0x0083; 
> *pUART_DLL=0x00b0; 
> *pUART_DLH=0x0000; 
> *pUART_LCR=0x0003; 
> } 
> 
> void main() 
> 
> { 
> 
> int a; 
> 
> serialin(); 
> 
> *pUART_GCTL=0x0001; 
> 
> *pUART_IER=0x0000; 
> 
> //polling for whether dat ready signal 
> //is set or not 
> while(((*pUART_LSR) & 0x0060) == 0x0060 ); 
> if ((*pUART_RBR)==0x0040) 
> { 
> *pUART_THR='B'; 
> while(((*pUART_LSR) & 0x0040) == 0x0040 ); 
> 
> while(1) 
> { 
> while(((*pUART_LSR) & 0x0060) == 0x0060 ); 
> a=*pUART_RBR; 
> *pUART_THR=a; 
> while(((*pUART_LSR) & 0x0040) == 0x0040 ); 
> } 
> 
> } 
> }
>



(You need to be a member of adsp -- send a blank email to adsp-subscribe@yahoogroups.com )