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 CCS Technical Support

ADH8066 code where to start
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
moryoav



Joined: 23 Feb 2014
Posts: 35

View user's profile Send private message

ADH8066 code where to start
PostPosted: Tue May 06, 2014 5:46 am     Reply with quote

so I'm using the GSM module ADH8066 with a pic18f2553 UBW.
at first i played a bit with the gsm using the terminal and it worked fine.
now i need to write a code to operate the module [mainly to make a call] and I've no idea how to do so.
the code I'm sure is basic, but they gsm shows no response.
adh8066 datasheet: http://goo.gl/gBOIk1
UBW datasheet: http://goo.gl/dWKs9w
pic datasheet: http://goo.gl/Oo5oIO

the code:
Code:
#include <18f2553.h> 
#fuses NOWDT, HS
#use delay (crystal=24MHz)
#use rs232 (baud=115200, xmit=PIN_C6, rcv=PIN_C7,stream=GSM, ERRORS)

void main()   


while(1)    //to check if the gsm calls a few times with no problems
{
     delay_ms(5000);           
     fprintf(GSM "ATD+972502141890;\r"); 
     delay_ms(15000);
     Fprintf(GSM "ATH\r");
}                   

}
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Tue May 06, 2014 7:13 am     Reply with quote

Hi,

Let's start with hardware first. The ADH8066 has a maximum input voltage of 4.5V. How are you powering the module, and what is the Vdd voltage on your PIC? I used the 'LF' version of the PIC I selected, and powered the ADH8066 and the PIC at 3.8V. This allowed me to connect them directly together.

The ADH8066 has a specific 'power up' sequence having to do with manipulating the 'Pwr_On' signal of the module. You don't appear to be doing that.

John
moryoav



Joined: 23 Feb 2014
Posts: 35

View user's profile Send private message

PostPosted: Tue May 06, 2014 7:20 am     Reply with quote

ezflyr wrote:
Hi,

Let's start with hardware first. The ADH8066 has a maximum input voltage of 4.5V. How are you powering the module, and what is the Vdd voltage on your PIC? I used the 'LF' version of the PIC I selected, and powered the ADH8066 and the PIC at 3.8V. This allowed me to connect them directly together.

The ADH8066 has a specific 'power up' sequence having to do with manipulating the 'Pwr_On' signal of the module. You don't appear to be doing that.

John
right now im powering both of them with usb so supply voltage isn't a problem. in the future i'll use a voltage regulator to regulate the pic's 5V to the GSM's 4V
and what do you mean about the 'power up' sequence and what is the "Pwr_ON"? how do i use it in the code?
Ttelmah



Joined: 11 Mar 2010
Posts: 19546

View user's profile Send private message

PostPosted: Tue May 06, 2014 7:49 am     Reply with quote

USB power is nominally 5v, so 'power voltage _is_ a problem'....
moryoav



Joined: 23 Feb 2014
Posts: 35

View user's profile Send private message

PostPosted: Tue May 06, 2014 8:04 am     Reply with quote

Ttelmah wrote:
USB power is nominally 5v, so 'power voltage _is_ a problem'....

it supplies it with 4V i checked so no worries Smile
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Tue May 06, 2014 8:43 am     Reply with quote

moryoav,

Hmmm, read section 3 of the ADH8066 datasheet you posted. In fact, read the entire document.

John
moryoav



Joined: 23 Feb 2014
Posts: 35

View user's profile Send private message

PostPosted: Tue May 06, 2014 8:50 am     Reply with quote

OH i foolishly fogot to mention i'm using an eval board ><
so i turned it on with the onkey
link: https://www.sparkfun.com/products/retired/10164
sorry for that
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Tue May 06, 2014 9:13 am     Reply with quote

moryoav,

Have you opened 'SJ4' and 'SJ5' to isolate the ADH8066 TxD and RxD signals from the FTDI USB chip? You don't want the FTDI chip in parallel with the PIC.

Also, walk before you run. When you are successfully communicating with the ADH8066, the module will respond with 'OK' when you send the 'AT' command.

You do have the AT command set document or the ADH8066, right?

John
moryoav



Joined: 23 Feb 2014
Posts: 35

View user's profile Send private message

PostPosted: Tue May 06, 2014 9:30 am     Reply with quote

ezflyr wrote:
moryoav,

Have you opened 'SJ4' and 'SJ5' to isolate the ADH8066 TxD and RxD signals from the FTDI USB chip? You don't want the FTDI chip in parallel with the PIC.

Also, walk before you run. When you are successfully communicating with the ADH8066, the module will respond with 'OK' when you send the 'AT' command.

You do have the AT command set document or the ADH8066, right?

John

what do you mean by opening them? to unsolder them? also how will that help?
and i do have the gsm and the AT commands. as i said before, i had no problems communicating with it- sending sms text and making a call. but now i need to do those things with a code and not via a terminal, and here i've no idea where to start.
i tried doing the same as i did with the EMIC (printf the AT commands) but it did not work so i came here for help :\
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Tue May 06, 2014 11:40 am     Reply with quote

Hi,

Yes, unsolder them. The ADH8066 cannot be connected to the FTDI chip and the PIC same time. This is a clear hardware problem.

Unsolder these connections and see if the PIC receives an 'OK' when you send "AT" and a carriage return.

John
moryoav



Joined: 23 Feb 2014
Posts: 35

View user's profile Send private message

PostPosted: Tue May 06, 2014 12:04 pm     Reply with quote

ezflyr wrote:
Hi,

Yes, unsolder them. The ADH8066 cannot be connected to the FTDI chip and the PIC same time. This is a clear hardware problem.

Unsolder these connections and see if the PIC receives an 'OK' when you send "AT" and a carriage return.

John

a main part of the problem is that i dont know HOW to write the programs to do those stuff. i dont know how to talk to the ADH8066 through the PIC in a C code. how do i adress to those pwr_ON\answer from the GSM pins or whatever? i've went though every link in google and i just can't understand it.
anyways i unsoldered them and ran the same program again and nothing happened. i also noticed that the RX\TX LEDs are not even blinking.
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Wed May 07, 2014 8:26 am     Reply with quote

Hi moryoav,

Frankly, you've bitten off quite a complex for a beginner. I would advise you to step back a bit and forget the ADH8066 for a moment. Instead, connect your PIC to your PC and experiment with serial communications with this combination first, before moving on to the ADH8066. Search the forum archives, as this has been covered many, many times before! Also, there is a complete GSM modem project in the Code Library that you could use as the basis for your project.

John
moryoav



Joined: 23 Feb 2014
Posts: 35

View user's profile Send private message

PostPosted: Thu May 08, 2014 6:02 am     Reply with quote

now i REALLY need help. now that the FTDI's rx soldering is ruined.
the only way i can talk to the gsm is through c codes and i dont know how -___-

how do i address in the code to the pins of the eval board?
for example: i want to turn off a led when the uC receives an OK from the GSM.
i wrote the following code:
Code:
#include <18f2553.h>                                         
#fuses NOWDT, HS
#use delay (crystal=24MHz)
#use rs232 (baud=2400, xmit=PIN_C6, rcv=PIN_C7,stream=GSM, ERRORS)

void main()
{
  output_high(PIN_B6); //LED
  fprintf(GSM, "AT\n\r");
// fprintf(GSM, "0x0D 0x00");  //is this command needed instead of the \n\r?
 
  if(input(PIN_B7))   //receives an OK from the GSM (had it connected to the DTR pin. is that the right connection to make?)
   output_low(PIN_B6);
   
}
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Thu May 08, 2014 6:47 am     Reply with quote

Hi moryoav,

Sorry to hear about your ADH8066 evaluation board! I hope that you have access to a low wattage soldering iron, and possibly some solder wick? Anything else, and you'll probably dislodge copper traces/pads on the board!

First, I used the Sparkfun ADH8066 evaluation when I was beginning my AHD8066 development effort. I found this board to be poorly designed (by Sparkfun), and configured in a way that was contrary to specific recommendations made by ADH in their hardware design guide. I find that a lot of the Sparkfun 'designs' are poor in this regard. Having said that, I got it to work fine for my initial development work. Basically, I used it to 'play' with the ADH8066 to see how it responded to the 'AT' command set, and to log the messages it would generate so that I could design a robust parsing routine.

From your comments, it seems that you are unclear about how the ADH8066 communicates with it's host microprocessor. This communication is done using asynchronous serial communications. For example, when the PIC host sends 'AT\r' to the ADH8066 via its UART Tx pin, the ADH8066 will (hopefully!) respond with 'OK' that is received via the PIC UART Rx pin. The required hardware connections are:

PIC UART Tx ---> ADH8066 UART Rx
PIC UART Rx <--- ADH8066 UART Tx

In general, the volume of data sent back and forth between the PIC and the ADH8066 is quite modest, so I do not use any hardware flow control. I connect ADH8066 pins DSR0 and DTR0 to ground thru 1K ohm resistors to disable flow control.

You will want your PIC to control the power up sequence of the ADH8066. I use a PIC pin configured as digital I/O to control the 'On_Key' signal using a BJT transistor and some discrete components. I also use two digital inputs to monitor the 'Net_Ready' and 'CMD_Ready' signals generated by the ADH8066. These signals let me know when everything is 'Good To Go'!

Just an FYI. I have designed several commercial products based on the ADH8066, but recently started to use the SIM900 for new designs as the ADH8066 is now 'end-of-life'. The SIM900 also has the advantage of being quite a bit cheaper that the ADH8066, although you need more external support components (antenna connector, SIM socket, etc.)

John

PS Did you look at the GSM 'driver' in the Code Library written by forum user 'Gabriel'?? He shows a couple of routines that will allow you to test the serial communications between the PIC and ADH8066.
moryoav



Joined: 23 Feb 2014
Posts: 35

View user's profile Send private message

PostPosted: Thu May 08, 2014 7:30 am     Reply with quote

ezflyr wrote:
Hi moryoav,

Sorry to hear about your ADH8066 evaluation board! I hope that you have access to a low wattage soldering iron, and possibly some solder wick? Anything else, and you'll probably dislodge copper traces/pads on the board!

First, I used the Sparkfun ADH8066 evaluation when I was beginning my AHD8066 development effort. I found this board to be poorly designed (by Sparkfun), and configured in a way that was contrary to specific recommendations made by ADH in their hardware design guide. I find that a lot of the Sparkfun 'designs' are poor in this regard. Having said that, I got it to work fine for my initial development work. Basically, I used it to 'play' with the ADH8066 to see how it responded to the 'AT' command set, and to log the messages it would generate so that I could design a robust parsing routine.

From your comments, it seems that you are unclear about how the ADH8066 communicates with it's host microprocessor. This communication is done using asynchronous serial communications. For example, when the PIC host sends 'AT\r' to the ADH8066 via its UART Tx pin, the ADH8066 will (hopefully!) respond with 'OK' that is received via the PIC UART Rx pin. The required hardware connections are:

PIC UART Tx ---> ADH8066 UART Rx
PIC UART Rx <--- ADH8066 UART Tx

In general, the volume of data sent back and forth between the PIC and the ADH8066 is quite modest, so I do not use any hardware flow control. I connect ADH8066 pins DSR0 and DTR0 to ground thru 1K ohm resistors to disable flow control.

You will want your PIC to control the power up sequence of the ADH8066. I use a PIC pin configured as digital I/O to control the 'On_Key' signal using a BJT transistor and some discrete components. I also use two digital inputs to monitor the 'Net_Ready' and 'CMD_Ready' signals generated by the ADH8066. These signals let me know when everything is 'Good To Go'!

Just an FYI. I have designed several commercial products based on the ADH8066, but recently started to use the SIM900 for new designs as the ADH8066 is now 'end-of-life'. The SIM900 also has the advantage of being quite a bit cheaper that the ADH8066, although you need more external support components (antenna connector, SIM socket, etc.)

John

PS Did you look at the GSM 'driver' in the Code Library written by forum user 'Gabriel'?? He shows a couple of routines that will allow you to test the serial communications between the PIC and ADH8066.

if your'e saying all it takes is to connect Rx to Tx and Tx to Rx, which is what i did, then all i can say is that my code is wrong.
as i said before, the Rx\Tx LEDs on the eval board does not even blink when i run the code.
so, is the first code i posted alright?
Code:
void main()
{
while(1) //to check if the gsm calls a few times with no problems
{

 delay_ms(5000);
 fprintf(GSM "ATD+972502141890;\r");
 delay_ms(15000);
 Fprintf(GSM "ATH\r");

}
}


also i will look for the said guide and hope it will help me.
thanks for the answer and sorry for the bother Sad
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2, 3  Next
Page 1 of 3

 
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