I have the Hilo module running ok on standalone mode through XP hyper terminal. Can send SMS and calls ok. Hilo baud rate is set at 9600.

I was reading on a forum that the serial library on the Arduino is only good for 9600 baud. I have dropped the rate down to this but does not make any difference. The serial from the arduino is currently running at 9600. I can't get the arduino to download the code to the libelium shield. The code will download with shield removed. But when i plug the shield in and press the reset button nothing happens with the hilo module.

I have the led on pin 13 as a visual cue that the code runs ok and it is. When trying to download from the Ardunio i get the out of sync general error. There are heaps of examples of this error on line but no solution.

If I remove the USB Arduino links on the Hilo shield I can get the download to work without sync errors but will not load into the Hilo of course. There may be a problem with these links, not sure.

If anybody can give me some advice I would be very grateful. I do not have any power supply current issues as per the libelium notes. I have added the capacitor and the supply is fine. Running version 18 arduino IDE. Using Duemilanove with 328 chip.

Thanks, Greg

  • 2
    \$\begingroup\$ I assume the downvotes were for the use of all caps? \$\endgroup\$ – Amos Jun 15 '10 at 8:19
  • 2
    \$\begingroup\$ Guess so, I made it more readable. \$\endgroup\$ – Toby Jaffey Jun 15 '10 at 8:25
  • \$\begingroup\$ Are you saying that you can't burn a sketch to the Arduino while the Libelium Hilo shield is attached? \$\endgroup\$ – vicatcu Jun 15 '10 at 14:03
  • \$\begingroup\$ I can't burn to the arduino with the shield attached with the 2 links in the Arduino postion. If the links are removed then it will burn ok. \$\endgroup\$ – Greg Higginbottom Jun 16 '10 at 3:20
  • \$\begingroup\$ I wish you lived in OK, I do not know arduino's well, but I can use an Oscope to find anything. \$\endgroup\$ – Kortuk Jun 16 '10 at 14:58

From the documentation, it looks like the Hilo shield is acting like a serial modem. Rather than "download code" to the shield, you should be using the Arduino to send "AT" commands to it.

There's sample code here.

  • \$\begingroup\$ Joby New to this type of forum. What is the best way to chat with you if this is permitted. Greg \$\endgroup\$ – Greg Higginbottom Jun 15 '10 at 9:28
  • \$\begingroup\$ Post comments, then when we're done, we can fold changes into the question and answers. \$\endgroup\$ – Toby Jaffey Jun 15 '10 at 10:00
  • \$\begingroup\$ Joby I have used the example code. First downloaded to the Arduino with Hilo off then replaced hilo and reset arduino but nothing happens. Not sure whats going on. There are no leds on the hilo to help with feedback. \$\endgroup\$ – Greg Higginbottom Jun 15 '10 at 10:52
  • \$\begingroup\$ I'm afraid that I haven't a clue, but hopefully somebody else will... \$\endgroup\$ – Toby Jaffey Jun 15 '10 at 11:05

Your comment about Arduino only being good for 9600 is interesting, and something I haven't heard before. It turns out that for reliable UART communication, you need a timing accuracy of less than +/- 2%. If you look into the datasheet of any AVR with a hardware UART, they have tables in the section detailing the UART Baud Rate Register (UBBR). These tables tell you, for specifical crystal choices, what the timing errorsr are for common baud rates. It is a good idea to pick an operating point in these tables with 0% timing error if at all possible...

Now to my knowlege, the Arduino operates at 16MHz and is based on the ATMEGA168 (manual here). You can see that the 16MHz crystal speed is not a "optimal" speed for UART operation, and all the "common" baud rates are within tolerance, but the "odd" crystal speeds like 3.6864MHz and 14.7456are the best. Here's an excerpt from the manual:

There are two possible sources for the receivers baud rate error. The Receiver’s system clock (XTAL) will always have some minor instability over the supply voltage range and the temperature range. When using a crystal to generate the system clock, this is rarely a problem, but for a resonator the system clock may differ more than 2% depending of the resonators tolerance. The second source for the error is more controllable. The baud rate generator can not always do an exact division of the system frequency to get the baud rate wanted. In this case an UBRRn value that gives an acceptable low error can be used if possible.

I don't know if this is the problem you're running into, but it's a possibility...

  • \$\begingroup\$ 2% is significantly smaller then the least allowable error. In a system with 8 bits of data, with a start and stop bit, you have 10 bits to each packet. When a packet starts the receiver synchronizes to it. With an error of less than 10% difference in clock rate of the two sides is met you will find there is no error, as on each bit you will stay within the band of the proper reading. \$\endgroup\$ – Kortuk Jun 15 '10 at 15:57
  • \$\begingroup\$ I hope that makes sense, often a computer is pretty spot on so you can have an error of almost 10% at your arduino without a problem. \$\endgroup\$ – Kortuk Jun 15 '10 at 15:57
  • \$\begingroup\$ @Kortuk, I'm just taking the datasheet at face value. A personal computer may very well be more tolerant than the AVR's UART to precision of your bit-timing. \$\endgroup\$ – vicatcu Jun 15 '10 at 20:28
  • \$\begingroup\$ Thanks for this information. I will try different rates and see if I can pick one that works. \$\endgroup\$ – Greg Higginbottom Jun 16 '10 at 3:22
  • \$\begingroup\$ Greg, I am sorry if I was not being clear, I was trying to make the point that unless you picked a horrible BAUD rate(one with more than 10% error on divide from system clock) then you should be fine. \$\endgroup\$ – Kortuk Jun 16 '10 at 14:52

Okay, I have two things I see.

Do you have the jumpers to choose between serial and USB set to serial when you connect it to the arduino? Setting the jumpers to USB will stop the arduino from being able to communicate with the shield. This is probably not it, but worth asking.

Second, if you are getting sync errors when you try to program with the hilo connected, is it trying to program over the same UART connection that the hilo will use? I do not know the arduino well, but it sounds like it is. The sharing of connections is not a problem, unless the hilo shield is communicating constantly and corrupting your communication data.

  • \$\begingroup\$ Kortuk I received a reply Libelium and they say that you must take the shield off to load the Arduino. This I have done but the shield still will not go. You can actually just remove one of the links and it will load with the shield on. I watched the serial output from the arduino and all is coming out correctly although there seems to be 2 characters appear before the AT commands come through. I have replied to Libelium so will wait until I get an answer from them. Thanks for your interest and suggestions. \$\endgroup\$ – Greg Higginbottom Jun 17 '10 at 5:47
  • \$\begingroup\$ Kortuk Point 2 above, Yes I think the Hilo is using the same pins for the serial bits. I don't know if there is any feedback from the Hilo as there are no led's or visual feedback. I did try to put more delays in the program so it has time to wait for the OK from the Hilo, but only guessing. I will copy the characters that appear and post this info, It may be a clue as to whats happening. \$\endgroup\$ – Greg Higginbottom Jun 17 '10 at 6:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy