Serial port problem with code without OS
Serial port problem with code without OS
Hi guys,
I have been running some tests with the code without OS, using the ADS 1.2 suite. I have been able to get serial port 1 to work but not serial port 2. Has anyone else experienced this same problem? Serial port 0 works and acts as the debug port as well.
Included is the function that I used to initialize the 3 UARTS.
//***************************[ UART ]******************************
static int whichUart=0;
void Uart_Init(int pclk,int baud)
{
int i;
if(pclk == 0)
pclk = PCLK;
rUFCON0 = 0x0; //UART channel 0 FIFO control register, FIFO disable
rUFCON1 = 0x0; //UART channel 1 FIFO control register, FIFO disable
rUFCON2 = 0x0; //UART channel 2 FIFO control register, FIFO disable
rUMCON0 = 0x0; //UART chaneel 0 MODEM control register, AFC disable
rUMCON1 = 0x0; //UART chaneel 1 MODEM control register, AFC disable
//UART0
rULCON0 = 0x3; //Line control register : Normal,No parity,1 stop,8 bits
// [10] [9] [8] [7] [6] [5] [4] [3:2] [1:0]
// Clock Sel, Tx Int, Rx Int, Rx Time Out, Rx err, Loop-back, Send break, Transmit Mode, Receive Mode
// 0 1 0 , 0 1 0 0 , 01 01
// PCLK Level Pulse Disable Generate Normal Normal Interrupt or Polling
rUCON0 = 0x245; // Control register
rUBRDIV0=( (int)(pclk/16./baud+0.5) -1 ); //Baud rate divisior register 0
//UART1
rULCON1 = 0x3;
rUCON1 = 0x245;
rUBRDIV1=( (int)(pclk/16./baud+0.5) -1 );
//UART2
rULCON2 = 0x3;
rUCON2 = 0x245;
rUBRDIV2=( (int)(pclk/16./baud+0.5) -1 );
for(i=0;i<100;i++);
}
I have been running some tests with the code without OS, using the ADS 1.2 suite. I have been able to get serial port 1 to work but not serial port 2. Has anyone else experienced this same problem? Serial port 0 works and acts as the debug port as well.
Included is the function that I used to initialize the 3 UARTS.
//***************************[ UART ]******************************
static int whichUart=0;
void Uart_Init(int pclk,int baud)
{
int i;
if(pclk == 0)
pclk = PCLK;
rUFCON0 = 0x0; //UART channel 0 FIFO control register, FIFO disable
rUFCON1 = 0x0; //UART channel 1 FIFO control register, FIFO disable
rUFCON2 = 0x0; //UART channel 2 FIFO control register, FIFO disable
rUMCON0 = 0x0; //UART chaneel 0 MODEM control register, AFC disable
rUMCON1 = 0x0; //UART chaneel 1 MODEM control register, AFC disable
//UART0
rULCON0 = 0x3; //Line control register : Normal,No parity,1 stop,8 bits
// [10] [9] [8] [7] [6] [5] [4] [3:2] [1:0]
// Clock Sel, Tx Int, Rx Int, Rx Time Out, Rx err, Loop-back, Send break, Transmit Mode, Receive Mode
// 0 1 0 , 0 1 0 0 , 01 01
// PCLK Level Pulse Disable Generate Normal Normal Interrupt or Polling
rUCON0 = 0x245; // Control register
rUBRDIV0=( (int)(pclk/16./baud+0.5) -1 ); //Baud rate divisior register 0
//UART1
rULCON1 = 0x3;
rUCON1 = 0x245;
rUBRDIV1=( (int)(pclk/16./baud+0.5) -1 );
//UART2
rULCON2 = 0x3;
rUCON2 = 0x245;
rUBRDIV2=( (int)(pclk/16./baud+0.5) -1 );
for(i=0;i<100;i++);
}
Re: Serial port problem with code without OS
Somebody, please help if you have been able to access serial port #2 in the code sample without OS. I have tried the 2440test code on 2 separate boards. Port #1 works great. I cannot get port #2 to work!!
2440lib.c is the file where the uarts are initialized. Can you guys see anything wrong with the code that I have included in my first posting?
2440lib.c is the file where the uarts are initialized. Can you guys see anything wrong with the code that I have included in my first posting?
Re: Serial port problem with code without OS
I have changed the Port H control register to enable RX2/TX2 instead of CTS1/RTS1 and still not getting sastifaction.
Has anyone been successful at dealing with UART #2 in the standalone program 2440test?
Anyone?
Has anyone been successful at dealing with UART #2 in the standalone program 2440test?
Anyone?
-
armboarder
- Posts: 15
- Joined: Thu Aug 27, 2009 12:45 pm
Re: Serial port problem with code without OS
Which board do you use ?
Is it Mini2440?
In this case you have only 1 RS232 level converter on your board, which can communicate with your PC. So you must add component or modify the serial cable to be able to communicate with your PC. What's your RS232 circuit schematic ? The issue seems to come from hardware.
Is it Mini2440?
In this case you have only 1 RS232 level converter on your board, which can communicate with your PC. So you must add component or modify the serial cable to be able to communicate with your PC. What's your RS232 circuit schematic ? The issue seems to come from hardware.
Re: Serial port problem with code without OS
I am using TTL inputs, so this is not an RS232 issue. As I mentioned before, the same TTL input works greate on TTL Port #1. It is port #2 that I can not get to work. I am sure that it is a setting issue as both of my boards don't work.
-
fdvalenzuela
- Posts: 3
- Joined: Sun Aug 23, 2009 12:43 pm
Re: Serial port problem with code without OS
Quick question... where did you get ADS1.2? I've looked everywhere and didn't find it, the ARM infocenter doesn't provide the suite, only different patches...
Re: Serial port problem with code without OS
ADS came on the CD.
-
fdvalenzuela
- Posts: 3
- Joined: Sun Aug 23, 2009 12:43 pm
Re: Serial port problem with code without OS
didn't come on my cd, didn't find it on the ftp...
Is it too much trouble for you to upload it to rapidshare, megaupload or a similar server? Or maybe you could create a torrent file and we could download it directly from your computer...
If you could do it, I woud be VERY grateful!!!
Thanks!
Is it too much trouble for you to upload it to rapidshare, megaupload or a similar server? Or maybe you could create a torrent file and we could download it directly from your computer...
If you could do it, I woud be VERY grateful!!!
Thanks!
Who is online
Users browsing this forum: No registered users and 2 guests