EmbeddedRelated.com
Forums

RCM4000: Ethernet and serial

Started by iw2nzm October 18, 2010
Hello,

I have a working board that uses an RCM4100. I need to switch to RCM4000 due to the ethernet support.
No problem no different pins, I checked the datasheet with my schematic.

Anyway I have some difficulties:

1) the RCM4000 requires a 20MHz clock (not doubled) in order to get the ethernet working. With such a clock I'm not able to get the correct baud rate for serials (9600, 57600, 115200). Setting the divisors lead to a too high baud rate mismatch. How to use both serials and eth?

2) Using the internal clock for eth how should I configure the PE6 pin?

3) Are there other pins I must take care of? I mean other than PE5-7 for leds.

Thanks in advance
Marco

On Oct 18, 2010, at 7:13 AM, iw2nzm wrote:
> 1) the RCM4000 requires a 20MHz clock (not doubled) in order to get the ethernet working. With such a clock I'm not able to get the correct baud rate for serials (9600, 57600, 115200). Setting the divisors lead to a too high baud rate mismatch. How to use both serials and eth?

The RCM4000 uses a 20MHz clock for the Ethernet, and a 29.49MHz clock, doubled to 58.98MHz as the processor clock. You shouldn't have any trouble running the serial port at 115200.

> 2) Using the internal clock for eth how should I configure the PE6 pin?
>
> 3) Are there other pins I must take care of? I mean other than PE5-7 for leds.

PE5-7 are used on the core module for the Ethernet connection. Don't do anything with them, and you should be fine. If I'm reading the schematic correctly, PE5-7 don't even come off of the core module.

Try using some of the standard RCM4000 samples, and you should see that you can use the Ethernet and serial ports as-is.

You may need to #use "RCM4000.LIB" and call brdInit() in your program to have it correctly initialize the board. I'm not sure though -- I haven't used an RCM4000 in a long time.

-Tom
Thank you for your answer.
I almost got it but there is a thing I don't understand.

You say: "The RCM4000 uses a 20MHz clock for the Ethernet, and a 29.49MHz clock, doubled to 58.98MHz as the processor clock."

But I must set the clock to 20.000 MHz in order to run the Ethernet (in fact on the board there is a 20 MHz crystal).

If in the I/O configurator I set the clock to 29.49MHz clock, doubled to 58.98MHz the eth won't work.

Please may you clarify this point?

Thanks again!
Marco

--- In r..., Tom Collins wrote:
>
> On Oct 18, 2010, at 7:13 AM, iw2nzm wrote:
> > 1) the RCM4000 requires a 20MHz clock (not doubled) in order to get the ethernet working. With such a clock I'm not able to get the correct baud rate for serials (9600, 57600, 115200). Setting the divisors lead to a too high baud rate mismatch. How to use both serials and eth?
>
> The RCM4000 uses a 20MHz clock for the Ethernet, and a 29.49MHz clock, doubled to 58.98MHz as the processor clock. You shouldn't have any trouble running the serial port at 115200.
>
> > 2) Using the internal clock for eth how should I configure the PE6 pin?
> >
> > 3) Are there other pins I must take care of? I mean other than PE5-7 for leds.
>
> PE5-7 are used on the core module for the Ethernet connection. Don't do anything with them, and you should be fine. If I'm reading the schematic correctly, PE5-7 don't even come off of the core module.
>
> Try using some of the standard RCM4000 samples, and you should see that you can use the Ethernet and serial ports as-is.
>
> You may need to #use "RCM4000.LIB" and call brdInit() in your program to have it correctly initialize the board. I'm not sure though -- I haven't used an RCM4000 in a long time.
>
> -Tom
>

iw2nzm said:
>
> Thank you for your answer.
> I almost got it but there is a thing I don't understand.
>
> You say: "The RCM4000 uses a 20MHz clock for the Ethernet, and a 29.49MHz
> clock, doubled to 58.98MHz as the processor clock."
>
> But I must set the clock to 20.000 MHz in order to run the Ethernet (in
> fact on the board there is a 20 MHz crystal).
>
> If in the I/O configurator I set the clock to 29.49MHz clock, doubled to
> 58.98MHz the eth won't work.
>
> Please may you clarify this point?
>
> Thanks again!
> Marco
>

The Ethernet will work because it has it's own clock, independent of the
CPU clock. The RCM4000 CPU doesn't run at 20MHz -- it uses the CPU clock
of 29.49MHz, doubled to 58.98MHz.

I haven't used the I/O configurator, but I imagine you should use the CPU
clock speed of 29.49MHz. The I/O configurator doesn't need to know
anything about the separate 20MHz clock that drives the Ethernet
interface.

-Tom

> The Ethernet will work because it has it's own clock, independent of the
> CPU clock. The RCM4000 CPU doesn't run at 20MHz -- it uses the CPU clock
> of 29.49MHz, doubled to 58.98MHz.
>
> I haven't used the I/O configurator, but I imagine you should use the CPU
> clock speed of 29.49MHz. The I/O configurator doesn't need to know
> anything about the separate 20MHz clock that drives the Ethernet
> interface.
Ok, thank you very much.
Tomorrow I'll try that way.

Marco

Hello again.

I still have some problems.
At first I want to get the board working only with serials.

This is my initialization routine:

serCopen(19200L);
WrPortI(SCCR,&SCCRShadow, 0x02);
serDopen(115200L);
WrPortI(SDCR,&SDCRShadow, 0x03);
serFopen(57600L);
WrPortI(SFCR,&SFCRShadow, 0x23);

WrPortI(PBDDR,&PBDDRShadow,0xFF); // Port B Input and output Pins
WrPortI(PCAHR,&PCAHRShadow,0xC0); // Port C Input and output Pins
WrPortI(PCFR,&PCFRShadow,0x15); // Port C Input and output Pins
WrPortI(PEAHR,&PEAHRShadow,0x44); // Port E Input and output Pins
WrPortI(PEALR,&PEALRShadow,0x30); // Port E Input and output Pins
WrPortI(PEDDR,&PEDDRShadow,0xA4); // Port E Input and output Pins
WrPortI(PEFR,&PEFRShadow,0xA4); // Port E Input and output Pins
WrPortI(TAT1R,&TAT1RShadow,0xFF); // Timer C
WrPortI(TCCSR,&TCCSRShadow,0x01); // Timer C
WrPortI(TCDHR,NULL, 0xE3); // Timer C
WrPortI(TCDLR,NULL, 0xCD); // Timer C
it hangs (both in debug or release mode) when I configure port C and port E.

If I don't configure them I can't receive data on serials, of course.

Where am I wrong?

Thanks!
Marco

On Oct 23, 2010, at 2:33 AM, iw2nzm wrote:
> serCopen(19200L);
> WrPortI(SCCR,&SCCRShadow, 0x02);
> serDopen(115200L);
> WrPortI(SDCR,&SDCRShadow, 0x03);
> serFopen(57600L);
> WrPortI(SFCR,&SFCRShadow, 0x23);
>
> WrPortI(PBDDR,&PBDDRShadow,0xFF); // Port B Input and output Pins
> WrPortI(PCAHR,&PCAHRShadow,0xC0); // Port C Input and output Pins
> WrPortI(PCFR,&PCFRShadow,0x15); // Port C Input and output Pins
> WrPortI(PEAHR,&PEAHRShadow,0x44); // Port E Input and output Pins
> WrPortI(PEALR,&PEALRShadow,0x30); // Port E Input and output Pins
> WrPortI(PEDDR,&PEDDRShadow,0xA4); // Port E Input and output Pins
> WrPortI(PEFR,&PEFRShadow,0xA4); // Port E Input and output Pins
> WrPortI(TAT1R,&TAT1RShadow,0xFF); // Timer C
> WrPortI(TCCSR,&TCCSRShadow,0x01); // Timer C
> WrPortI(TCDHR,NULL, 0xE3); // Timer C
> WrPortI(TCDLR,NULL, 0xCD); // Timer C
Try letting RS232.lib take care of the port initializations for you. I think that the function help for serCopen lists macros you can set in your program to control which pins are used for Tx and Rx for each serial port (if you're not using the default pins).

Your serial initialization should be as simple as:
serCopen(19200L);
serDopen(115200L);
serFopen(57600L);

At that point, you can read and write each serial port, and the timers are set up correctly for the baud rates requested.

-Tom
Perhaps I'm wrong. And I will be very happy to be:

may I use the serial F on PE2/PE3?

The RCM4000 user manual:

http://www.rabbit.com/documentation/docs/manuals/RCM4000/RC4000UM.pdf

says yes in both table 2 and table 3.
But figure 7 says only PE0 is available.

It the figure is right it's *impossible* to use serials C, D and F at the same time!

I think the documentation is not very handy on this topic.

Marco

--- In r..., Tom Collins wrote:
>
> On Oct 23, 2010, at 2:33 AM, iw2nzm wrote:
> > serCopen(19200L);
> > WrPortI(SCCR,&SCCRShadow, 0x02);
> > serDopen(115200L);
> > WrPortI(SDCR,&SDCRShadow, 0x03);
> > serFopen(57600L);
> > WrPortI(SFCR,&SFCRShadow, 0x23);
> >
> > WrPortI(PBDDR,&PBDDRShadow,0xFF); // Port B Input and output Pins
> > WrPortI(PCAHR,&PCAHRShadow,0xC0); // Port C Input and output Pins
> > WrPortI(PCFR,&PCFRShadow,0x15); // Port C Input and output Pins
> > WrPortI(PEAHR,&PEAHRShadow,0x44); // Port E Input and output Pins
> > WrPortI(PEALR,&PEALRShadow,0x30); // Port E Input and output Pins
> > WrPortI(PEDDR,&PEDDRShadow,0xA4); // Port E Input and output Pins
> > WrPortI(PEFR,&PEFRShadow,0xA4); // Port E Input and output Pins
> > WrPortI(TAT1R,&TAT1RShadow,0xFF); // Timer C
> > WrPortI(TCCSR,&TCCSRShadow,0x01); // Timer C
> > WrPortI(TCDHR,NULL, 0xE3); // Timer C
> > WrPortI(TCDLR,NULL, 0xCD); // Timer C
> Try letting RS232.lib take care of the port initializations for you. I think that the function help for serCopen lists macros you can set in your program to control which pins are used for Tx and Rx for each serial port (if you're not using the default pins).
>
> Your serial initialization should be as simple as:
> serCopen(19200L);
> serDopen(115200L);
> serFopen(57600L);
>
> At that point, you can read and write each serial port, and the timers are set up correctly for the baud rates requested.
>
> -Tom
>

Although the application is pretty bad, use the IO config tool to configure
all your IO and then you only have to make one call to setup the ports. I
have all 5 serial ports working before with the RCM4000 so it is possible.
You can see this in the IOconfig tool.

Dave...
---
Very funny Scotty, now beam down my clothes!!!
---
http://www.axoninstruments.biz
---

From: r... [mailto:r...] On
Behalf Of iw2nzm
Sent: 24 October 2010 01:44
To: r...
Subject: [rabbit-semi] Re: RCM4000: Ethernet and serial

Perhaps I'm wrong. And I will be very happy to be:

may I use the serial F on PE2/PE3?

The RCM4000 user manual:

http://www.rabbit.com/documentation/docs/manuals/RCM4000/RC4000UM.pdf

says yes in both table 2 and table 3.
But figure 7 says only PE0 is available.

It the figure is right it's *impossible* to use serials C, D and F at the
same time!

I think the documentation is not very handy on this topic.

Marco
I did, but it doesn't work. Anyway, how to set the serial F on PE2 and PE3? The documentation says yes and no in different tables/figures as I said before.

Please, if you are sure it's possible, may you tell me how to?
When I try to write the PEFR the MCU hangs up.

Furthermore I've just tried another way:

the PE2-PE3 (pins 34-35 of the MCU) are not connected to the connector pins 34-35.
In fact, the schematics of RCM4000 shows they are disconnected from MCU due to the NAND flash configuration.

It is possible to change the hw configuration in order to use PE2/3 and NOT the NAND flash?

Marco

--- In r..., "Dave McLaughlin" wrote:
>
> Although the application is pretty bad, use the IO config tool to configure
> all your IO and then you only have to make one call to setup the ports. I
> have all 5 serial ports working before with the RCM4000 so it is possible.
> You can see this in the IOconfig tool.
>
>
> Dave...
> ---
> Very funny Scotty, now beam down my clothes!!!
> ---
> http://www.axoninstruments.biz
> ---
>
> From: r... [mailto:r...] On
> Behalf Of iw2nzm
> Sent: 24 October 2010 01:44
> To: r...
> Subject: [rabbit-semi] Re: RCM4000: Ethernet and serial
>
>
>
> Perhaps I'm wrong. And I will be very happy to be:
>
> may I use the serial F on PE2/PE3?
>
> The RCM4000 user manual:
>
> http://www.rabbit.com/documentation/docs/manuals/RCM4000/RC4000UM.pdf
>
> says yes in both table 2 and table 3.
> But figure 7 says only PE0 is available.
>
> It the figure is right it's *impossible* to use serials C, D and F at the
> same time!
>
> I think the documentation is not very handy on this topic.
>
> Marco
>