Hello,
I’m trying to upload the 3phase sketch to a new Emontx.
The download of the FW goes well. When I select the option to upload the 3phase sketch, I get an error “avrdude-original: usbdev_open(): did not find any USB device “usb” (0x03eb:0x2104).
Lsusb shows that there is a programmer connected:
“Bus 001 Device 004: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x UART Bridge / myAVR mySmartUSB light”.
The option " view serial debug” works also. I’m using the programmer from the shop, it is connected to a USB port of the Raspberry. The cable is one that I got, not the one from the shop.
When I look at the emonupload script it is looking at /dev/ttyUSBx.
When I connect the programmer, I get a ttyUSB0 device. The lsusb utility shows the programmer at /dev/bus/usb/001/004
Is there a way to read from these devices using a basic linux command in order to see that they react?
I think there maybe some cross wires somewhere that perhaps @glyn.hudson can shed some light on.
As I understand, you are using a shop bought programmer, that will be a USB to serial programmer type. The logs show “avrispmkII” specified in the avrdude command line which is an “ISP” type programmer. Since it appears the “Serial output” works I took to looking at the emonupload.py code as it cannot be a simple case of wrong programmer used/defined.
It would appear the serial upload will only work after a successful upload of a bootloader via an ISP, so it seems you need 2 programmers connected to the same device at the same time to complete a simple firmware update/change, in the process the bootloader will be changed each time.
I do not think that is the intended behaviour, perhaps @glyn.hudson can confirm, I think if the command to burn the bootloader was wrapped in a try/except it might allow the code to proceed rather than tripping up when there is no ISP attached.
As a quick test you could try adding a # to comment out line 255 of emonupload.py so it skips actually trying (it will still say it’s doing it but not action the command) to upload a bootloader via the ISP programmer that isn’t there and proceeds directly to attempting to upload the latest firmware hex via the serial adapter.
emonupload first attempts to upload a bootloader using an ISP programmer, if no ISP programmer is connected this fails then emonupload goes onto upload the compiled .hex via serial. This is nothing to worry about, as long as the serial upload part is working that is all the matters if uploading to a unit which already has an Arduino bootloader in place (as is the case with all the shop bought units).
However, please clarify that without line 255 commented emonupload fails to upload serial for you?
I often use emonupload without an ISP programmer connected to just upload via serial to units already with a bootloader. In my experience with no programmer connected emonupload prints a warning then continues to upload serial successfully.
Glyn,
Now I’ve completely lost track
As said, I used the programmer from the shop, it connects the USB port on the Raspberry to the UART port on the Emontx, so this is a serial connection.
You say “with no programmer connected emonupload prints a warning then continues to upload serial successfully”.
How can I upload without using the programmer as a connection? I thought it is mandatory to transfer the sketches.
I’ve have little experience with this stuff so I’m afraid I’m lacking some knowledge here.
The ISP programmer connects to the 3 x 2 header, and is a totally different thing to the FTDI programmer, which is the one we think you have.
Your FTDI programmer from the shop needs a “bootloader” inside the Atmel ATMega 328P to be able to work.
The ISP programmer does not need that and is able to install the bootloader if you do not have one.
Robert, Glyn,
I had a look at the pcb of the emontx and it is correct I’m using the ftdi connector, not the 2x3 isp interface. To me it means that I use the same method as you do Glen. Here it works when I comment out the loading of the bootloader, with you it simply skips it.
If there would realy be a problem with the script, somebody else also would have reported it as well. So it looks l’m doing something different then you do.
I have a second, older emontx but I don’t have it at home now. I’ll run the upload on that one, just to try. That will only be in two weeks when I get the unit
Dirk.
I’m struggling with this too… I just ordered 2 EmonTx v3 and the USB > UART programmer from the shop. This is the output I get…
Enter lettercode for required function > 3
emonTx 3-phase Upload
Burning Bootloader..try avrispmkII
avrdude -p atmega328p -c avrispmkII -P usb -e -U efuse:w:0x05:m -U hfuse:w:0xD6:m -U lfuse:w:0xFF:m -U flash:w:bootloaders/optiboot_atmega328.hex:i -Ulock:w:0x0f:m
avrdude done. Thank you.
Burning Bootloader..try usbasp
avrdude -p atmega328p -c usbasp -P usb -e -U efuse:w:0x05:m -U hfuse:w:0xD6:m -U lfuse:w:0xFF:m -U flash:w:bootloaders/optiboot_atmega328.hex:i -Ulock:w:0x0f:m
avrdude: error: could not find USB device with vid=0x16c0 pid=0x5dc vendor='www.fischl.de' product='USBasp'
avrdude done. Thank you.
Serial upload latest/openenergymonitor-emontx-3phase.hex:i
ERROR: USB serial programmer NOT found
Error: Cannot connect to RFM69Pi receiver. Upload only...NO RF TEST
Done emonTx 3-phase upload. Press Enter to return to menu or (s) to view serial output>
parallels@parallels-Parallels-Virtual-Platform:~/OEM/emonupload$ lsusb
Bus 001 Device 003: ID 203a:fffa
Bus 001 Device 002: ID 203a:fffa
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 002: ID 203a:fff9
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x UART Bridge / myAVR mySmartUSB light
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
You shouldn’t need to be burning a bootloader. The emonTx already has it and the default sketch loaded, ready to go. All you should need is to compile and upload the 3-phase sketch using the Arduino IDE.
Can you see what USB port number is assigned to your programmer by looking at the output of dmesg after plugging in your programmer?
Is there a chance that your USB serial port requires root permissions?
Either chance the permissions or try running emonupload as sudo
I believe Barry is trying to upload the pre-compiled version of the emonTx-3phase .hex file. Uploading the pre-compiled version is a wise move as it negates the requirement to download all the required libs and avoid any possible errors introduced in the compiling process.
So the sudo option has worked (well got me further down the line). I’m still getting an error, but it looks like there is no emonTx 3 phase hex file downloaded as it’s not in the “latest” folder as per the error stated here. There are plenty of others so the download appears to have worked? Is the file mis-named or missing?
avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: NOTE: “flash” memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file “latest/openenergymonitor-emontx-3phase.hex”
avrdude: can’t open input file latest/openenergymonitor-emontx-3phase.hex: No such file or directory
avrdude: read from file ‘latest/openenergymonitor-emontx-3phase.hex’ failed
avrdude done. Thank you.
Error: Cannot connect to RFM69Pi receiver. Upload only…NO RF TEST