Hi,
I am using the RCM4400 wireless module. I am working with the serial port using flow control. The problem is with DMA, and the flow control signals (CTS, RTS).
With a sample program such as simple5wire.c, the TX line is connected to the RX line, and CTS is connected to RTS. The pins assigned for CTS and RTS are specified in the sample file - see below:
#define SERC_RTS_PORT PCDR
#define SERC_RTS_SHADOW PCDRShadow
#define SERC_RTS_BIT 0
#define SERC_CTS_PORT PCDR //CTS on Parallel Port C
#define SERC_CTS_BIT 1 // CTS on bit 1
Using simple5wire.c and these default settings, the flow control works nicely. With RTS (PortC bit 0) connected to CTS (PortC bit 1), characters flow from TX to RX and they are displayed on STDIO. This is a good demonstration that flow control works. When CTS is disconnected from RTS, data flow stops.
But I want to use Serial DMA. When Serial DMA is enabled, the pin used for CTS must be a Port D or Port E pin, not a Port C pin. Here is the statement from RS232.LIB, function serCflowcontrolOn(), around line 2390:
Important Note:
---------------
The Rabbit 4000 has the option of using DMA for serial rs232.
The DMA options supports flow control, but the ports and pins
for CTS are limited to the following:
PD2, PD3, PE2, PE3, PE6, PE7.
Because the DMA flowcontrol uses the external request feature,
only 2 serial ports can use DMA flowcontrol at a time. One
can use PD2, PE2, or PE6, and the other can use PD3, PE3 or PE7.
There is no requirement (that I can find) for the RTS signal. I have the RTS signal on Port C bit 0.
I changed the simple5wire.c example program so that the CTS signal was on Port D bit 2:
#define SERC_RTS_PORT PCDR
#define SERC_RTS_SHADOW PCDRShadow
#define SERC_RTS_BIT 0
#define SERC_CTS_PORT PDDR // test CTS on PortD
#define SERC_CTS_BIT 2 // test CTS on bit 2
With this setup, CTS no longer has any influence on flow control. This is the problem. If RTS is disconnected from CTS, the character flow should stop. It does not.
Note - I am NOT using Serial DMA with simple5wire.c. I just want to use the same CTS pin that is required when Serial DMA is enabled.
Can someone tell me what I am doing wrong?