Issues Loading Sketch [Solved]

I just received the prebuilt EmonTX V3.  Out of the box, everything is working perfectly and it is transmitting to my RaspberryPi and I am getting data in EmonCMS.  The board does need calibrating as the numbers are off a little bit.

I opened up a sketch and modified the calibration numbers and cannot get the sketch to upload to the EmonTx.

I connected the EmonTx to my USB-UART adapter and get the following through the Arduino IDE serial port monitor.  So there is at least some communication between the EmonTX and my computer.

emonTx V3 Discrete Sampling V1.3
OpenEnergyMonitor.org
Performing power-on tests.....please wait 10s
CT 1 Calibration: 90.90
CT 2 Calibration: 90.90
CT 3 Calibration: 90.90
CT 4 Calibration: 16.60
RMS Voltage on AC-AC Adapter input is: ~1V
AC-AC adapter NOT detected - Apparent Power measurements enabled
Assuming VRMS to be 230V
Assuming powering from batteries / 5V USB - power saving mode enabled
CT 1 detected
Unable to detect DS18B20 temperature sensor
RFM12B Initiated:
Node: 10 Freq: 433Mhz Network: 210
0
0

However, when I try to upload a sketch I get the following error.

         System wide configuration file is "C:\Program Files (x86)\Arduino\hardware/tools/avr/etc/avrdude.conf"

         Using Port                    : \\.\COM3
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Recv: . [00]
avrdude: stk500_getsync(): not in sync: resp=0x00

avrdude done.  Thank you.

I have verified that the connections are correct, I am using the right port (COM3), and the scilabs CP210x driver is installed.  I have also checked that Arduino Uno is the selected board and I am on Windows 7.

Any ideas on what could be wrong?

Paul Reed's picture

Re: Issues Loading Sketch [Solved]

Do you have all of the required libraries installed?

Paul

ridemx's picture

Re: Issues Loading Sketch [Solved]

I have the nine listed in step 5 here and they all show up under File>Sketchbook>libraries in the Arduino IDE :

http://openenergymonitor.org/emon/buildingblocks/installing-arduino-libr...

Is this all of them?

Paul Reed's picture

Re: Issues Loading Sketch [Solved]

Yes.
That error code does normally appear if the wrong serial port is selected or the wrong board is selected, but in your case you you have selected UNO which is correct and also appear to have the correct serial port (as you can see the output)....

Paul

dBC's picture

Re: Issues Loading Sketch [Solved]

It could also be that the toggle RTS/DTR -> target reset path is not working, although I've no idea why it would be.  You could try hitting the target 'Reset' button manually, just as you click on 'Upload' on the IDE and see if that works.  The timing is pretty critical, so you may need to play around with it a bit. After reset, the bootloader will wait for about a second for an image to start coming down the serial port.  If it hears nothing within that second, it'll jump to the system image and stop listening on the serial port.

A test for this theory is does the target remain undisturbed by the attempt to upload a new image. Does it just keep running what it was running, or does it look like it's been reset?  Most bootloaders flash the status LED, so that may be a clue.

I've had a target where that path was broken, and eventually I got pretty good at the timing.  Make sure the image is pre-compiled (using the "Verify" tick button in the IDE) so that it's ready to go.  Then click on 'Upload' at pretty much exactly the same time as you manually hit the RESET button, and it mostly works out ok.

If that does fix it, then we can investigate why that path is broken.

ridemx's picture

Re: Issues Loading Sketch [Solved]

That was the issue, thank you very much!  I wasn't using the USB-UART adapter from the shop here, but was instead using one I already had for an unrelated project.  The one I had laying around connects to the device through a 4 wire cable.  I connected +5V, GND, Tx, and Rx and missed RTS, but after going and making a 5th jumper to connect the RTS, everything works.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.