9S08AW32 SCI using interrupts - how to use hardware CTS/RTS

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

9S08AW32 SCI using interrupts - how to use hardware CTS/RTS

1,884 Views
UcTechnoGeek
Contributor II
I have a 9S08AW32 using the SCI to read commands and write text messages out to a terminal window (Hyperterminal in Windoze).

I needed to add a function to transfer a approx 1Mb file from the PC side to an external SPI flash on the uC (speed is not a big concern).

I thought this would be easy, I'll just use CTS/RTS handshaking, enable interrupts and set up a 256 Byte buffer that stops the transfer when full (to write out to the SPI flash).

Everything but the handshaking is working.  I have a female DB9 on my board that connects to the PC via a serial to USB converter.  I'm using CTS (pin 8 on the DB9) to control the flow from the PC (I don't send any data back during the transfer, so I'm not using RTS). When my buffer is almost full, I raise the CTS pin, wait to see if any additional SCI data is in transit and then go into my SPI routines.Handshaking is enabled in hyperterminal, but the data does not stop coming.

It appears to work with a few bytes, but when I try an amount of data that requires me to pause the flow, it doesn't seem to work.

Any suggestions or examples??
Thanks,
uCTechnoGeek
Labels (1)
0 Kudos
Reply
2 Replies

346 Views
bigmac
Specialist III
Hello,
 
There are two types of hardware handshaking.  The most common one is RTS/CTS, but there is also DTR/DSR. Check that the teminal program is set up for the requred one.
 
The UART in the PC will most likely utilize a FIFO buffer, and the buffer may need to empty before transmission ceases.  Therefore the handshake signal should be de-activated well before the buffer is full, to allow for the size of this buffer.
 
When you say that you "raise the CTS pin", to which side of the RS232 buffer do you refer?  Devices such as the MAX232 invert the signal.  The active state for CTS will be high on the line side, and low on the MCU side.
 
Regards,
Mac
 
0 Kudos
Reply

346 Views
JimDon
Senior Contributor III
You should also consider XON/XOFF most terminal programs support this.
Hardware flow control always seem problematic.
However if you are sending binary data you will have to escape these characters.
If it is ACSII data, it will be easy.
You may not wish to confront this, but in the long run it will work better.


0 Kudos
Reply