Welcome! Log In Create A New Profile

Advanced

Can't program Tronxy P802M

Posted by 10k 
10k
Can't program Tronxy P802M
February 17, 2017 12:25PM
I have a Tronxy P802M. I've been trying to update the firmware.
I bought a USBASP V2.0 programmer off eBay, plus a 10 to 6 pin adapter.

I ran this command on AVRDUDE to make a copy of the existing code:

avrdude -p m1284p -P usb -c usbasp -U flash:r:TronxyP802M.bin:r

That seemed to work fine. I can look at the generated file with a text editor, and it seems to be there - I can see some of the text that appeared on the printer screen.

Then I removed the jumper at the bottom of the Melzi board, cycled the power, and tried to flash some new firmware using this commend:

avrdude -p m1284p -P usb -c usbasp -U flash:w:Firmware1.1.hex

The programming light on the USBASP comes on, but after it finished, I get an error code. If I replace the jumper and reboot the printer, all I see is two rows of boxes on the screen - no text.

Any ideas?
===============================================================================

C:\WINAVR~1\bin>avrdude -p m1284p -P usb -c usbasp -U flash:w:Firmware1.1.hex

avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e9705
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: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: reading input file "Firmware1.1.hex"
avrdude: input file Firmware1.1.hex auto detected as Intel Hex
avrdude: writing flash (128916 bytes):

Writing | ################################################## | 100% 71.92s



avrdude: 128916 bytes of flash written
avrdude: verifying flash memory against Firmware1.1.hex:
avrdude: load data flash data from input file Firmware1.1.hex:
avrdude: input file Firmware1.1.hex auto detected as Intel Hex
avrdude: input file Firmware1.1.hex contains 128916 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 65.86s



avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0002
0xdb != 0xff
avrdude: verification error; content mismatch

avrdude: safemode: Verify error - unable to read lfuse properly. Programmer may not be reliable.
avrdude: safemode: Verify error - unable to read lfuse properly. Programmer may not be reliable.
avrdude: safemode: Sorry, reading back fuses was unreliable. I have given up and exited programming mode

avrdude done. Thank you.
10k
Re: Can't program Tronxy P802M
February 17, 2017 08:28PM
I've done some more work on this. I noticed that when I read the device signature, I was getting one of the bits incorrect. I could unplug the USBASP, and then it would read correctly. I did the same thing for the Fuses. Again, they'd be unavailable, then after unplugging and plugging, I could read them. It's almost as something is causing the USB connection to die. I noticed that when I unplug it, I don't get the windows USB tone. I do get it when I plug it back in, and if I remove it without using it. Strange.

I'm thinking it's the Windows 10 driver, the USBASP, the cable, or the 10 to 6 pin adapter. I uninstalled the driver, and got a fresh copy from www.fischl.de, disable driver signature checking, and installed. Same result. I unplugged and replugged each connection several times in case one was loose. Same result. I examined the cable and adapter - they look OK. I'm now thinking about getting another USBASP. This one is made in the US, and claims to fix another problem I've had setting the sck (which from what I've read seems to be OK, even with the Warning it generates.)
[www.ebay.com]

Any help or recommendations would be appreciated.
10k
Re: Can't program Tronxy P802M
March 01, 2017 03:35PM
I found the problem. Here's a summary of what I learned, in hope that you don't spend as much time spinning your wheels as I did.
I had a SD card in the slot. REMOVE THE CARD!!! Once I pulled it out, all the programming verify errors went away! That only consumed about 15 hours to figure out.

I got a US-made USBasp programmer, but I don't think that was the problem. It did eliminate the sck warnings.
It did not seem to matter where the 3-pin jumper in the middle was set - USB or Vreg (default) worked while programming.
It did not seem to matter where the 2 pin jumper at the bottom was set - Upload or Run (default) worked while programming.
I did not need to push the reset button on the Melzi v2 to program, as some threads indicated.

It took me a while to figure out that you can program from either the USB or from a USBasp. The main program goes into the 128k Flash memory, and can be done with the USB cable.
To program the 4k bootloader in the eeprom or read/write the fuses, you need a USBasp programmer with either a 6-pin cable or 10 to 6 pin adapter.

Although I don't know how, I did manage to reset one of the fuses. Luckily, I had written down the default settings (D6 - DC - FD) The symptom was that after programming, the program would not run reliably. It would start up directly after programming, but not when the power was cycled. The middle fuse was changed to DA, and when I reset it to DC, all was good.

There were lots of version of Repetier and Marlin out there. I used this version of Marlin to program: [github.com]. I've just started using it, but it appears that it works fine as-is.
I primarily used Arduino v1.0.6, although I also used AVRDude, and then AVRDudess (which is easier to use). Note that Arduino will try to program though the serial port - even if it's not connected. If you want to use the USBasp, pick File - Upload using programmer.

You must add some board definitions to Arduino to program the Tronxy. I used Sanguino (sorry- don't remember where I got it). On Windows 10, I went to the My Documents - Arduino directory. Here, make a new subdirectory called "hardware". Drop the entire Sanguino directory inside of this subdirectory. If you do this right, you'll get a Sanguino w/ ATmega 1284P 16 mhz option under Tools - Board in Arduino the next time you run it. (And possibly a few other optinos around this board). The newer 1.8.x versions of Arduino use another web-based method to download new boards. I don't know if the newer versions work with the Tronxy or not.

Good luck!

Edited 1 time(s). Last edit at 03/01/2017 03:36PM by 10k.
Re: Can't program Tronxy P802M
March 01, 2017 08:28PM
Good to heard that you figured them out !
Did you check the no so active now forum of unofficial zonestar P802 ttread?
It probably would give you more info as well as an access to a Srinivasan with working Marlin and Repetier too.
It is probably at second page.
If you search.
Good luck!!!!
Re: Can't program Tronxy P802M
March 03, 2017 02:16AM
10K,

Are you using the auto leveling or the standard Z stop? I just built the same printer and really would like to add auto leveling.My machine came with a Melzi and Repetier firmware. Looking at the Marlin FW.

Also, that Chinese USB ASP can be reprogrammed to eliminate the SCK errors. Easy to do with your US programmer. I reflashed the 3 Chinese programmers I have. Now there's no error.

Thank you.

Edited 1 time(s). Last edit at 03/03/2017 02:17AM by Twmaster.


--
TW
10k
Re: Can't program Tronxy P802M
March 03, 2017 10:46AM
I'm adding auto leveling. I'm using a LJ18A3-8-Z-BX-8mm-Approach-Sensor-Inductive-Proximity-NPN-NO-Switch I got at:
[www.ebay.com]

I used the bigger switch since I have a piece of borosilicate glass on top of the aluminum heating bed. The switch is too close to the glass when triggered by the aluminum, so I put a thin piece of copper sheet under the glass. The switch now trips about 1/8" above the glass. A thin piece of steel would probably have worked a little better, but I had lots of copper sheeting and no thin steel. Also, copper is better for heat transfer.

I mounted the switch on a redesigned support piece for the print head blower. I also added a couple of CREE LEDs to the mount that are focused on the print head. I just redesigned it slightly, so after I make sure it works OK, I'll post the design to Thingiverse.

I have everything installed and wired up, but I need to resize the dividing resistors in the circuit because the switch is not tripping correctly. I don't think it's a big problem - I just got distracted by all these programming problems and have not done it yet.

Thanks for the tip about reprogramming the Chinese USBasp. I had seen some posts about this, but at the time, I didn't have another programmer to do it with!
Re: Can't program Tronxy P802M
March 03, 2017 04:39PM
Thank you. I'll be looking for your updates.


--
TW
Re: Can't program Tronxy P802M
March 05, 2017 02:33AM
I have exactly the same problem with a Tronxy p802m. I've spent a couple of days now trying to upgrade the firmware with a new build. The unit came with .91, and I built a 92.9. But so far, using two linux systems and a Win10 system, I've been unable to get the firmware flashed.

I've mostly used avrdude directly, though I've also gone through the Arduino IDE. The bottom line is that I can get avrdude to claim it's uploading, but the verify always fails (just as in your case, at 0x0002). The old firmware is left in place, so there's no sign that the chip is being erased at all, despite what avrdude reports. However, avrdude is clearly talking to the chip -- even the signature matches. Downloads of the existing firmware via avrdude are fine. One thing I have not done is change the autoreset jumper -- it came installed and I've left it in place so far. I should add that when dumping the existing firmware, avrdude says that all the fuses are set to 0.

When I saw your mention of removing the SD card I thought that might be it -- I had one in there. But removing it has made no difference, and I'm completely stymied for now. Any additional ideas would be greatly appreciated. Thanks!

Edited 1 time(s). Last edit at 03/05/2017 02:36AM by TT3002.
10k
Re: Can't program Tronxy P802M
March 05, 2017 10:54AM
Sorry you're having trouble. I'm not sure that I can help much, but I can give you some things to try.

Both AVRDUDE and Arduino (which I think uses AVRDUDE or something like it) are very poor at letting you know if they have a connection to the ATMega or not. They'll go through the motions even if there is no connection at all, and give you a sync error at the end. I found that the easiest way to verify a connection was to use AVRDUDESS. There's a button that says "Detect" under MCU. (you can also use AVRDUDE directly with command line switches, but the button is easier) If it successfully communicates with the ATMega, it'll identify it as an ATMega 1284p. Otherwise, it'll say "Unable to detect MCU". I also had trouble with it detecting sometimes, but not others. I could click on the "Detect" button several times in a row, and it would identify the processor correctly several times, then not detect it once or twice, then identify it correctly again several times. That's when I realized that I had an unreliable connection. I saw the same thing when I clicked repeatedly on "Read" for the Fuses - correct several times, then no read, then read with one fuse slightly different, then correct again.

If you're not using Arduino 1.0.6, you might try that. I read several posts about the newer version not working with the P802m. I didn't verify that, though.

You didn't mention if you are using the USB connection or a USBasp programmer. Once I got a reliable connection, I used the programmer and Arduino to "Burn Bootloader" under tools. I used the USA-made USBasp. I didn't try it with the Chinese USBasp, so I don't know if either of these things - the Bootloader or the USBasp - helped. I have not tried to program via the USB connection since I got all this working, so I don't know if that works or not.

Good luck, and I feel your frustration!
Re: Can't program Tronxy P802M
March 05, 2017 11:43AM
Hi. Avrdude claims the chip signature matches, so apparently real communication is taking place at some level (but as I noted, it also claims the fuses are all 0 -- is this right???). I'm pretty sure the current Repetier builds won't compile with the older Arduino. I've been doing all this via a direct USB connection. I don't have a programmer at this point, and the expense of a non-Chinese one for this single case may be difficult to justify. Thanks for your help!
10k
Re: Can't program Tronxy P802M
March 05, 2017 11:56AM
It may be that you can't read or set the fuses through the USB connection. Perhaps someone else can confirm? It may require a programmer. This is the one that I got It was $13.

[www.ebay.com]

The fuses can't all be 0. Here's a webpage that describes the settings in extreme detail:

[www.engbedded.com]
Re: Can't program Tronxy P802M
March 05, 2017 12:02PM
I'll probably just buy that and be done with it. Do you have a good reference page for power, hookup, and programming instructions (e.g. Arduino settings, which bootloader to flash, how to flash the bootloader and firmware via this device, etc.? It comes with the correct cable to hookup to the connector on the Tronxy clone board? Thanks!

Edited 2 time(s). Last edit at 03/05/2017 12:05PM by TT3002.
10k
Re: Can't program Tronxy P802M
April 17, 2017 03:03PM
I finally got around to posting the design of the Proximity Probe holder on Thingiverse. Here's the link:

[www.thingiverse.com]

The probe works great. Much better and much more consistent than checking the alignment by hand.
Re: Can't program Tronxy P802M
April 17, 2017 03:58PM
For the record, I ended up using this:

[www.thingiverse.com]

I recommend full infill to avoid having the inductive probe snap the plastic under unusual stress (ask me how I know!). Printed easily with simple supports. I use an aluminum bed, with white masking tape and a layer of Dollar Store stick glue as my usual surface, with excellent results. I do recommend always bringing the extruder and bed to printing temperature before homing with z-probe or running the bed leveling calibration routine. I do the former between each print, and the latter in "temporary" (don't save to EEPROM) mode once at the start of a series of prints. I print PLA at ~205C with bed temp ~55C. I use the current Repetier dev code (1.0.0dev). It wouldn't fit in the chip initially, but I never print with sdcard so I compiled without that code and got lots of room back. Configuring this code correctly for any given printer does take some work. My z-probe is wired in series with the original z-axis switch. The latter is now adjusted to act as a failsafe in case the z-axis ever tries to home when the probe is off the bed -- though this has not happened to date. Getting new firmware burned in can be a bit tricky with various of these units, but once you get the hang of the process it's fairly straightforward. I was initially skeptical of the usefulness of the auto bed leveling routines, but I'm a believer now -- I haven't had to touch the manual bed adjustments in weeks at least. Feel free to drop me a note if you have any questions on getting this all going.
Re: Can't program Tronxy P802M
April 19, 2017 11:51PM
TT are you using the original Melzi board on your P802?

I'm asking because this auto-leveling stuff is confusing the daylights out of me. I've watched some YouToob videos and I just get more confused. The thing is I am not new to Arduinos and programming them so I can grok the changes needed to the config files for the firmware and I have no issues loading firmware either via the IDE or AVRDUDE directly with a USBasp.

I think maybe I'm missing something simple or over thinking this. I'm in the middle of installing a completely new X-carriage setup made from 2020 extrusion and have designed into my E3D mount a sensor holder. I'd like to use this.

(10K, I'm sorry if this is hijacking your thread I can make another thread if you like)


--
TW
Re: Can't program Tronxy P802M
April 20, 2017 12:53AM
Yes, I'm using the original "Melzi" board. If you can be a bit specific about your autoleveling issues I'd be glad to help.
Sorry, only registered users may post in this forum.

Click here to login