Communication between PIC16F887 and Fastrack Supreme 20

Hello everyone,

I have set up serial communication between a PIC16F887 and the Wavecom Fastrack Supreme 20, this is at 9600 baud rate, 8data bits, 1 stop bit and no flow control or parity. The tx of the PIC is connected to the rx of the module, and the rx of the PIC is connected to the tx of the module and the ground pin is used as well. Flow control on the module is disabled as well as parity. I am able to send data to the PIC and reply back to the module only once and then after that the PIC won’t respond. Can anyone think of what the problem might be? When communicating with the PIC through hyper terminal everything works great the whole time?

Thank you

So what about communicating with the Fastrack through hyper terminal :question:

Be sure to use exactly the same connection…

Something strange is going on. Let me explain, at first I couldnt communicate with the PIC at all, then I found out that I need to connect the the tx pin of the PIC to the rx pin of the module and the rx pin of the PIC to the tx of module. So I switched my tx and rx lines on a serial cable. When I connect to hyperterminal through this cable (with the module) I get nothing, but when connected to the PIC I receive and send data (only once). But when connected to hyperterminal with a normal cable I receive and send to the module fine, but not to the PIC. What am I missing?

You need to connect DTR. Module requieres it to open the port. So connect any output port from the pic to the DTR and send the DTR Signal as your pc with the hyperterminal does.

Hiya,

It’s the difference between connecting DTE and DCE devices and the way that the pins are named.

A DTE (Data Termination Equipment) device (such as a PC) has TxD as an OUTPUT (i.e. Data is Transmitted), and RxD as an INPUT (i.e. Data is Received)
A DCE (Data Communications Equipment) device (such as a Modem) has TxD as an INPUT (i.e Data is Received), and RxD as an OUTPUT (i.e. Data is Transmitted). This is so that a straight through cable between a DTE and DCE is wired TxD to TxD, RxD to RxD etc.

Now, the PC is a DTE device, and so is the PIC; the Modem is wired as a DCE device. Can you see now why your cable needs to be swapped around (crossed over) when connecting the PC to the PIC, then the PC to the Modem?

This issues are RS232 comms 101. You need to get your head around this.

Sounds like you are getting a buffer overrun in the PIC USART because you are not servicing the RxD interrupt quickly enough. When you are connected to the PIC using hyperterm, you are manually typing the responses which is giving the PIC enough time to read the USART buffer. The Modem is sending responses at full speed (i.e. 9600 baud), and your PIC gets the first character, moves it to the RX Buffer, then the second character is received before your PIC program has read the first one. When the PIC USART tries to copy the second received character into the RX buffer, it notes that the first character hasn’t yet been read - so it sets the Overrun Error bit and shuts down the USART RX.

Does this help?

ciao, Dave

It helps a lot thanx Dave, I was a bit confused about the DTE DCE situation. I only send one character from the fastrack to the PIC. I do have error correction code on the pic that monitors overflow error and clears the error bit if it occurs, but it
still only allows me to send one character from the module to the PIC and then the pic replies with a AT+SEND command which works and after that no communication occurs.

Thanx, I will try this and see if it works.

Sortega, it is my understanding that the DTR is used for flow control, I have flow control disabled, do I still need to use DTR? see tldp.org/HOWTO/Serial-HOWTO-20.html

Thanx

Thanx guys I sorted out my problem. When using the at+send=data command from the PIC the module needs to respond with \r\nOK\r\n otherwise it waits for it and would not send anything else.