CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Problem with RS232 found, but not solution

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Prefekt



Joined: 21 Oct 2010
Posts: 85

View user's profile Send private message

Problem with RS232 found, but not solution
PostPosted: Sat Jun 11, 2011 9:56 am     Reply with quote

Hello,

I have a SIMCOM900B GSM module connected with the pic18F2550 via RS232.
It works fine.

The problem is, the start from the SIMCOM900B Module. To start PIN_A2 is going high, then wait 1.2 seconds, PIN_A2 low, wait 2.2 seconds. The the module is ready and the RS232 from the module is also ready and sends Information.

If I start the module with a switch, no problem. But when I start the module with the pic like:
Code:
void powerup_SIM900B(void){
   output_high(SIM900BPWR);
   delay_ms(1200);
   output_low(SIM900BPWR);
   delay_ms(2200);
   }


The PIC RXD is hanging up. When i disconnect the RX PIN (C7) before I start the module and connect RX after start from module it works.

So there must be a signal in the delay_ms() on RX that the RXD PIN is hanging up.
Is there a posibility to disable RS232 or the PIN and enable it later?
I have solved it with a relay, but not my favorite...

Thanks
Volker
Ttelmah



Joined: 11 Mar 2010
Posts: 19358

View user's profile Send private message

PostPosted: Sat Jun 11, 2011 2:41 pm     Reply with quote

Just add 'errors' to your RS232 declaration.

The module probably drops the RS232 line at some point in the wake up. This results in the internal RS232 buffer overflowing (only two characters), which hangs the RS232 receive, unless you add code to clear this. Adding the keyword 'errors' to the RS232 declaration, makes the compiler automatically do this, and the RS232 will then still work (probably have a couple of garbage characters you should read).

Best Wishes
Prefekt



Joined: 21 Oct 2010
Posts: 85

View user's profile Send private message

PostPosted: Sun Jun 12, 2011 8:17 am     Reply with quote

Hello,

I have added the 'error', but no effect!

In the help file is describe the rs232_errors variable. But the compiler is not knowing this and throw an compile error.

Here ist my rs232 definition:
Code:
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8, errors)


any other ideas? How can I clear this manual?

Thanks
Volker
temtronic



Joined: 01 Jul 2010
Posts: 9169
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Jun 12, 2011 9:13 am     Reply with quote

Please post a small, compilable code that shows the problem, include the PIC type and Compiler version as well.
Prefekt



Joined: 21 Oct 2010
Posts: 85

View user's profile Send private message

PostPosted: Sun Jun 12, 2011 9:59 am     Reply with quote

Hello,

with the ex_usb_serial example I can generate the error.
PIC is 18F2550 and Compiler Version is 4.088.

Could it be a compiler problem? Perhaps I should get the newest verison!?

I have read in some threads compiler throw a warning when use 'errors'. But I cant's see a warning! Also the compiler not known the 'RS232_ERRORS' variable!


Thaks

Volker
Desert Leo



Joined: 08 Jun 2011
Posts: 7

View user's profile Send private message

PostPosted: Sun Jun 12, 2011 10:43 am     Reply with quote

Volker, are you sure that when PIC RX pin is disconnected during power up of GSM module everything is OK. Or it is PIC TX pin? Some GSM modules hungs-up when voltage is aplied to input pin BEFORE power on.

Also check for some "hallo" message from GSM module to UART after power on.
Ttelmah



Joined: 11 Mar 2010
Posts: 19358

View user's profile Send private message

PostPosted: Mon Jun 13, 2011 2:00 am     Reply with quote

This is a very good point.

First, on the RS232_ERRORS. Two things here. It is possibly that you have the warning this raises 'turned off' in the compiler settings.
Second, on not being able to find the variable. Is it possible you have #CASE selected?. If so, are you sure of the case of the RS232_ERRORS variable?.

Then on the comment from Desert Leo.

Configure the RS232 with:

#use rs232(baud=0,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8, errors)

This sets up the UART, but leaves it turned off.

Then after the initialisation sequence if sent to the modem, use:

setup_uart(9600);

which will turn it on, and set the baud rate to 9600bps.

The UART pins will remain as inputs, till this occurs (unless you access then yourself).

Best Wishes
Prefekt



Joined: 21 Oct 2010
Posts: 85

View user's profile Send private message

PostPosted: Mon Jun 13, 2011 3:40 am     Reply with quote

@Desert Leo.
Yes, it is the RX pin from PIC. When I pull off this pin and connect it when the module is ready, it works. The module is not hanging up.

@Ttelmah,
I not use the #CASE statement. I get any other Warnings like 'Condition always TRUE' and so on.
I have tried 'RS232_ERRORS' and 'rs232_errors', same problem.
So I think there is everything wrong with the compiler.
It seems that the 'errors' in rs232 definition has no effect.

Where is the RS232_ERRORS defined?

Thanks
Volker
Desert Leo



Joined: 08 Jun 2011
Posts: 7

View user's profile Send private message

PostPosted: Mon Jun 13, 2011 5:09 am     Reply with quote

Proceed as described in Ttelmah's last post.
In your code put the row "setup_uart(9600);" AFTER GSM power on command.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group