Forums

ISP, UART0, UART1... comm to another cpu

Started by flashzr January 8, 2011
Hi, I'm new here and new to LPC2101.

I'm reading the PDFs and creating the PCB at the same time,
and I need some pointers.

I know that:
The chip is programmed through UART0.
UART0 has RX/TX only, while UART1 has full modem control lines.

My problem is that the LPC will also have to use
the UART to communicate with another CPU.

The simplest thing would be to use UART1 for that purpose,
but UART1 uses RTS, CTS, and such.

Q: Can I disable the modem control signals in UART1
that I don't really need? I need only RX and TX to communicate
with that other CPU.

Or should I connect both ISP hardware and other CPU to UART0?

Or.. what?

An Engineer's Guide to the LPC2100 Series

UART0 can be used for both: as programming port and to communicate with another CPU. If ISP pin (P2.10) is low while RESET pin is going from low to high, LCP enters boot programming mode. Otherwise, LPC is entering user mode.
Many boards have jumper in front of ISP pin. Just remove this jumper and LPC will not enter programming mode. Another solution is, use Flash Magic. After you download program in LPC, choose GO.. and switch LPC to user mode. In user mode, USART0 is only under control of your (user) program and you can do whatever like and even to communicate with another CPU.
You can also use UART1. If you need not modem signals RTS, DRT, etc, just don't use them. Read carefully LPC user manual and set USART1 registers appropriately.

--- In l..., "flashzr" wrote:
>
> Hi, I'm new here and new to LPC2101.
>
> I'm reading the PDFs and creating the PCB at the same time,
> and I need some pointers.
>
> I know that:
> The chip is programmed through UART0.
> UART0 has RX/TX only, while UART1 has full modem control lines.
>
> My problem is that the LPC will also have to use
> the UART to communicate with another CPU.
>
> The simplest thing would be to use UART1 for that purpose,
> but UART1 uses RTS, CTS, and such.
>
> Q: Can I disable the modem control signals in UART1
> that I don't really need? I need only RX and TX to communicate
> with that other CPU.
>
> Or should I connect both ISP hardware and other CPU to UART0?
>
> Or.. what?
>

There also other chips with 4 uarts. But I am quite shure that only one port
would be enough.

Att.

2011/1/8 zoran.mijanovic

> UART0 can be used for both: as programming port and to communicate with
> another CPU. If ISP pin (P2.10) is low while RESET pin is going from low to
> high, LCP enters boot programming mode. Otherwise, LPC is entering user
> mode.
> Many boards have jumper in front of ISP pin. Just remove this jumper and
> LPC will not enter programming mode. Another solution is, use Flash Magic.
> After you download program in LPC, choose GO.. and switch LPC to user mode.
> In user mode, USART0 is only under control of your (user) program and you
> can do whatever like and even to communicate with another CPU.
> You can also use UART1. If you need not modem signals RTS, DRT, etc, just
> don't use them. Read carefully LPC user manual and set USART1 registers
> appropriately.
>
> --- In l... , "flashzr"
> wrote:
> >
> > Hi, I'm new here and new to LPC2101.
> >
> > I'm reading the PDFs and creating the PCB at the same time,
> > and I need some pointers.
> >
> > I know that:
> > The chip is programmed through UART0.
> > UART0 has RX/TX only, while UART1 has full modem control lines.
> >
> > My problem is that the LPC will also have to use
> > the UART to communicate with another CPU.
> >
> > The simplest thing would be to use UART1 for that purpose,
> > but UART1 uses RTS, CTS, and such.
> >
> > Q: Can I disable the modem control signals in UART1
> > that I don't really need? I need only RX and TX to communicate
> > with that other CPU.
> >
> > Or should I connect both ISP hardware and other CPU to UART0?
> >
> > Or.. what?
> >
>
--- In l..., "zoran.mijanovic" wrote:
>
> UART0 can be used for both: as programming port and to communicate with another CPU.

And how do I prevent another CPU from listening and responding
to ISP commands issued to LPC?

Also, TXD from another CPU and TXD from ISP programmer will be in
short circuit, if I don't add some complexity (a jumper, at least),
which I'd rather not.
> You can also use UART1. If you need not modem signals RTS, DRT, etc, just don't use them. Read carefully LPC user manual and set USART1 registers appropriately.

Simple as that? Should I assign them as regular I/O pins?

Using UART1 as simple UART would be best, as this guy wants:
http://embeddedrelated.com/groups/lpc2000/show/3285.php
just that I wish to use RXD and TXD only.

--- In l..., "flashzr" wrote:
>
> --- In l..., "zoran.mijanovic" wrote:
> >
> > UART0 can be used for both: as programming port and to communicate with another CPU.
>
> And how do I prevent another CPU from listening and responding
> to ISP commands issued to LPC?
>
> Also, TXD from another CPU and TXD from ISP programmer will be in
> short circuit, if I don't add some complexity (a jumper, at least),
> which I'd rather not.
>
Well, you can't... I have the same problem when I use lpc21isp to program a device while I still have minicom (Linux comm program) connected to the port.

Clearly ISP will be done using a level shifter such that the signals are actually at RS232 levels. You may decide that inter-processor communications do not require level shifting. So there is the first problem; voltage levels.

On most development boards, the serial port is level shifted and brought out to a DB9 connector. No problem; plug in the cable for ISP while programming and then plug in another cable for something else.

I would install a 2 wide by 3 deep header and use a jumper plug to select whether the serial pins connect to the level shifter for ISP or to some other scheme for inter-processor comms. Or, a DPDT toggle switch.

Another choice: give up on ISP and just use JTAG for programming. This might involve giving up some pins.

Yet another: consider doing all your serial communications by way of RS485 level translation. This protocol was always intended to be multi-master. You can buy an RS232 to RS485 converter. This is just a guess, I haven't actually tried it.

Or just use UART1 for inter-processor comms.

Richard

On 01/08/2011 08:28 PM, flashzr wrote:
> And how do I prevent another CPU from listening and responding to ISP
> commands issued to LPC?
>
> Also, TXD from another CPU and TXD from ISP programmer will be in
> short circuit, if I don't add some complexity (a jumper, at least),
> which I'd rather not.

Because you haven't thought disconnecting the cable as an option, I'll
assume that the two CPUs are on the same board and communicate in TTL
levels. Then I'd add a couple of ideas after Richard's:

You could put a resistor into the TXD signal of the other CPU so that
when you connect ISP, it wins.

You might use some kind of protocol between the CPUs so that the other
CPU doesn't respond to ISP commands.

>> You can also use UART1. If you need not modem signals RTS, DRT,
>> etc, just don't use them. Read carefully LPC user manual and set
>> USART1 registers appropriately.
>
> Simple as that? Should I assign them as regular I/O pins?

So you have not yet done any programming on bare metal for UARTs. When
you start, you'll notice that UARTs typically doesn't use handshake
signals for anything. You can read and write them from your program and
that's pretty much all.

--

Timo
--- In l..., "rtstofer" wrote:
> Or just use UART1 for inter-processor comms.

Yes, thats what I would like to do. Much easier.

Just don't know if its doable with RX & TX only, w/o CTS, RTS, DTR...

Not sure if I could just connect
RTS to CTS
DTR to DSR to DCD
that is how I saw on a standard PC serial port.

I'm creating my own board, so I'll give it a try.

--- In l..., Timo wrote:
> You might use some kind of protocol between the CPUs so that the
> other CPU doesn't respond to ISP commands.

Can't do that. The other CPU (AT91SAM9260) may be in BootROM
and expecting commands through UART.
> So you have not yet done any programming on bare metal for UARTs.

Not with handshake signals.

> When you start, you'll notice that UARTs typically doesn't use
> handshake signals for anything. You can read and write them from
> your program and that's pretty much all.

Thats great news, then I'll just use UART1 for CPU comm.
Wondering why did they include it then?

On 01/08/2011 10:12 PM, flashzr wrote:
> Timo wrote:
>> When you start, you'll notice that UARTs typically doesn't use
>> handshake signals for anything. You can read and write them from
>> your program and that's pretty much all.
>
> Thats great news, then I'll just use UART1 for CPU comm. Wondering
> why did they include it then?

Include what? The handshake signals? Users' manual says in UART
features: "Register locations conform to 550 industry standard". They
try to keep it compatible in some sense with 16550 which itself is
reminiscence of 8250 from IBM/PC era.

--

Timo
Don't enable the modem control signals.

DaveS

On Fri, Jan 7, 2011 at 2:28 PM, flashzr wrote:

> Hi, I'm new here and new to LPC2101.
>
> I'm reading the PDFs and creating the PCB at the same time,
> and I need some pointers.
>
> I know that:
> The chip is programmed through UART0.
> UART0 has RX/TX only, while UART1 has full modem control lines.
>
> My problem is that the LPC will also have to use
> the UART to communicate with another CPU.
>
> The simplest thing would be to use UART1 for that purpose,
> but UART1 uses RTS, CTS, and such.
>
> Q: Can I disable the modem control signals in UART1
> that I don't really need? I need only RX and TX to communicate
> with that other CPU.
>
> Or should I connect both ISP hardware and other CPU to UART0?
>
> Or.. what?
>
>
>