Nano clone Ch430 LED Fast blinking no upload reset line declared as output

Hi, I have a nano china clone here. As I am writing my own kernel I did the stupid mistake to put the following code regarding the gpio peripheral:

   < DDRC = 0xffu;
    PORTC = 0xffu;
DDRD = 0xffu;
    PORTD = 0x00u; >

In words, after the upload the Reset and RxD are both declared as output and the reset is also put to high.

The behaviour after the upload is a fast blinking D13 Builtin LED and the upload is not possible any longer.

I tried to alter the code in a way that it would ignore the before mentioned pins and everything works fine.

I have now two questions:

  1. How do I recover the two boards which are flashed with the faulty code. I do have the Atmel Ice programmer if that is of any help. Though it uses also the resetline

  2. Can someone explain the fast blinking LED? I don't touch that pin in my code. I think it flashes with 10 Hz. It must be the bootloader who turns it on and it goes off when the faulty program causes a reset.

I really would like to see a flowchart of the upload process, if anyone could guide me to that, that'd make me happy.

Welcome to the forum

Can you program the bad board using a good board as a programmer ?

Take a look at the ArduinoISP example sketch

If you reprogrammed RESET pin, the only way to undone it is using i.e. "avr high voltage programmer" circuit - search google for it

I am wondered with beginners who start working with arduino by writing their own kernel...

I am not new to embedded only to atmega.

The High Voltage programmer is more expensive than the two boards, so I put them in the bin.

In the meantime, I found the flowchart and all the Info I longed for. The Bootloader flashes the LED right after the HW Reset occurs, and my program does a reset and the boot loader flashes again, all in all periodically.

Thanks to the two of you, I've been helped!

You can make it yourself, it required a few parts...

Building my own HV programmer looks is something very useful when working on AVR chips. It might come back to bite me if I don't do it now.

I would have to alter it as I am not using Atmega328 with Dip pins. Instead I could put a socket for Nano board. I checked, all the required pins are accessible on the Nano board.

Setting ddrd to 0xff should not disable the reset pin. You need fuse setting to do that…