[ECOS] Adding more serial ports
Steve Gaskill
sgaskill@powerfile.com
Fri Oct 24 11:36:00 GMT 2008
> > I'm trying to use all four serial ports on my NXP LPC2388 device with
> > eCos. After looking through the eCos reference, searching the mailing
> > list archives, and doing a LOT of grepping, I made a number of changes
> > to eCos.
> >
> > The problem is that I can't receive data on channels 2 and 3. I was
> > thinking I had screwed-up a CDL file or something, but strangely,
> > everything WORKS when running under the Keil JTAG ULINK2 debugger.
>
Hi Chris,
> Are you doing any configuration via JTAG that you aren't doing without (eg.
> peripheral bus setup, GPIO configuration, etc.)?
There are no code differences (same binary) between standalone and JTAG runs.
> Can you see data in the RX FIFOs without JTAG attached?
I do get data in the RX register w/o JTAG -- in fact my temporary workaround is to read from the UART register instead of calling cyg_io_read.
> Do interrupts arrive for the two additional serial ports when data comes
> into the RX FIFO?
Now I'm not sure why it was working in the JTAG environment (because now it isn't). I think the Keil debugger may install some kind of monitor, because the serial port configuration *changes* (i.e. receive data interrupt gets enabled for the additional serial ports) when the debugger is started.
That got me to thinking, why weren't the receive data interrupts automatically enabled on ports 2 and 3, like they were (by default) on 0 and 1? I dug around in the eCos sources and in the eCos doc, and finally was able to fix my problem.
All I had to do was manually enable the receive data interrupt for the ports. Here is a snippet of code that enabled the receive data IRQ for serial port 2, in case anyone else runs into this problem.
hal_virtual_comm_table_t* comm;
int cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT);
CYGACC_CALL_IF_SET_CONSOLE_COMM(2);
comm = CYGACC_CALL_IF_CONSOLE_PROCS();
CYGACC_COMM_IF_CONTROL(*comm, __COMMCTL_IRQ_ENABLE);
CYGACC_CALL_IF_SET_CONSOLE_COMM(cur);
The only question I have now is why is this IRQ (in the UART) enabled by default for ports 0 and 1, but not for ports 2 and 3? Is this expected, or have I not "copied" something correctly when creating ports 2 and 3?
Thanks for your help,
Steve
PowerFile, Inc
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
More information about the Ecos-discuss
mailing list