Go Down

Topic: 168PA-based Nanos not possible to program or change bootloader (Read 912 times) previous topic - next topic

MagnusWed

Feb 13, 2019, 11:48 pm Last Edit: Feb 19, 2019, 11:46 pm by MagnusWed Reason: Where's the attachments?
Hello,

I bought a bunch of Chinese Arduino Nano Clones from China.
If I connect the Nano in its current state to the Serial monitor using 9600 it shows "ready".
If I send an "a" it results with "test passed!" all other charachers return error so I think this is some kind of selftest from the factory? But it odes not seem possible to program them with anything else..

I've tried everything now trying to program my Chinese Clones of Arduino nano using ArduinoIDE and kind of nothing works. I've tried using a Arduino Pro Micro as "Arduino As ISP" by no luck at all. I think I've connected them correctly. My chinese clones uses a 168PA device with a 12Mhz crystal. (see details below in dump)

My next try was Atmega chip programmer by Nick Gammon, which actually gives result but it is not possible to write the bootloader because the process hangs half-way through. Look at text dump below. After "Fixing low fuse setting ..." nothing happens. Is that step suppose to take long time?

Best regards
Magnus

-snip-
Atmega chip programmer.
Written by Nick Gammon.
Version 1.38
Compiled on Feb 13 2019 at 23:27:47 with Arduino IDE 10802.
Attempting to enter ICSP programming mode .....................
Entered programming mode OK.
Signature = 0x1E 0x94 0x0B
Processor = ATmega168PA
Flash memory size = 16384 bytes.
LFuse = 0xFF
HFuse = 0xDA
EFuse = 0xFD
Lock byte = 0xFF
Clock calibration = 0xAC
Bootloader address = 0x3E00
Bootloader length = 512 bytes.
Type 'Q' to quit, 'V' to verify, or 'G' to program the chip with the bootloader ...
Fixing low fuse setting ...
-snip-

AWOL


MagnusWed

Yea good question. I did this back in 2016 when I got these. The answer is missing now from my aliexpress account (old age?)


They were very helpful and this is the most important answer I got:
-snip-
Hello frined,
In one lot, have problem with bootloader. Can you update bootloader from ISP?
-snip-

So normally It comes with as bootloader preinstalled but this batch had problems. I got a refund but are trying to get them working again. Still it should be possible to bootload it?


Have you tried contacting the manufacturers?

BJHenry

12MHZ is a strange frequency for a Nano. Are they made by WAVGAT?
The easiest thing to do would be buy a proper programmer (like a USBASP, they can be had for next to nothing off Aliexpress too) and then burn a fresh bootloader. You'd need to use Minicore though to account for different frequency.

MagnusWed

12MHZ is a strange frequency for a Nano. Are they made by WAVGAT?
OK yea I was hoping for NOT buying another HW but maybe that is the only thing to do to save them? Or just buy new ones with bootloader already there.

These are made by RobotDyn:
http://robotdyn.com/~iiVMG

Yea I already installed Minicore in ArduinoIDE (after other tip when googling) and are using the m168p/12Mhz setting with it, still no luck.
It always ends with several:
avrdude: stk500_getsync(): not in sync: resp=0x00

Sometimes only 0x00 values and sometimes other values in the 10 tries it makes before aborting.

For now I'm not connecting the RESET when using the Gammon-tool but instead running the reset by hand.
I'm getting very close to scrapping these.. but for now it is more like an exercise in learning details about bootload-programming.




pert

Please try the using the Arduino as ISP to do a Tools > Burn Bootloader using the appropriate MiniCore board selection (make sure to set Tools > Clock > 12 MHz external). Burning the bootloader is an essential step if you want to use Minicore. If you have troubles burning the bootloader then come back here with a detailed description and we'll help you out.

david_2018

Are you sure the ATmega168PA is running off 12MHz?
If the board has a CH340 serial chip, that uses its own 12MHz crystal.

CrossRoads

Look closer at your board - there is likely a little 3-pin resonator near the clock pins of the uC, while the xtal connects to 2 pins on the USB chip.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

BJHenry

These are made by RobotDyn:
http://robotdyn.com/~iiVMG
That's good then, I use these too (although the 328 version) and am very happy with them. The 12MHz crystal is actually for the USB-Serial chip. The 16MHz crystal is the one that the ATMega168 uses so you should be able to upload to it like a normal Nano. My Robotdyn Nanos do use the old bootloader so be careful about that.
Do you know if the original bootloader is still on there? I ask because you've mentioned trying to upload via ISP and if you've done that you will have overwritten the bootloader.
The best way to check is by powering the Nano up and watching the onboard LED. It should blink once.
If you the bootloader is gone you'll need to reupload it. Using a dedicated programmer is easy, using another Arduino is cheap.

MagnusWed

Thank you guys for feedback! Still the only 3 evidence of life in these are:

1) When connecting to ArduinoIDE's Serial monitor using 9600 Baud this is was comes back:

-snip-
Ready
test pass
Fail!
test pass
Fail!
Fail!
Fail!
Fail!
Fail!
-snip-

"test pass" if I write an 'a' on the keyboard and 'Fail!' for everything else. Some kind of self-test from facory.

2) When connecting to other working Arduino Micro Pro, I get another COM-port started a short while after pressing reset (maybe 5s) if looking in Device Manager. Think it is called Leonardo or something similar. Don't know if this is way in?

3) When running Nick Gammon's tool via other working Arduino Micro Pro:
-snip-
// Atmega chip programmer
// Author: Nick Gammon
// Date: 22nd May 2012
// Version: 1.37
-snip-

I get the output shown in the first post.
I don't have any idea what to try next?

This is pictures of device:



BJHenry

1) When connecting to ArduinoIDE's Serial monitor using 9600 Baud this is was comes back:

*snip*

"test pass" if I write an 'a' on the keyboard and 'Fail!' for everything else. Some kind of self-test from facory.
This is kind of useful- it means that we know the USB-Serial side of things is working and that you haven't overwritten the original bootloader via ISP.

2) When connecting to other working Arduino Micro Pro, I get another COM-port started a short while after pressing reset (maybe 5s) if looking in Device Manager. Think it is called Leonardo or something similar. Don't know if this is way in?
The Leonardo and Micro have native USB, so they work a bit different to the the Uno and Nano. The COM port for the Nano shouldn't change or disappear/reappear when you press the reset button.

3) When running Nick Gammon's tool via other working Arduino Micro Pro:
-snip-
// Atmega chip programmer
// Author: Nick Gammon
// Date: 22nd May 2012
// Version: 1.37
-snip-
This doesn't really help at all, it doesn't give any information about that the programmer is actually doing.


Do you know if the original bootloader is still on there? I ask because you've mentioned trying to upload via ISP and if you've done that you will have overwritten the bootloader.
The best way to check is by powering the Nano up and watching the onboard LED. It should blink once.

Go Up