Issues programming the v4 Leaf modules


I am having a couple of issues trying to get vscode to program the leaf module. I think i may have 2 issues.

1, Which module should i select in the platformio env section? The comments list a lot of different versions but none mention the leaf module (mine is a JLCPCB buit one with 8x 33R0 resistors).

2, “Target doesn’t answer”. I tied the 421 version and it breifly flashes the green led but then says it cant connect. I am using the USBASP programmer and have tested all the pins are connected correctly. If I use avrdude on the command line i can get it to read the firmware from the attiny but only if i use the -B 12 option to slow down the SCK freq to 32000 Hz. I dont know why this is needed but is there an option to specify this in the platform io config?

Hopefully this is an easy fix if somebody else has had similar issues :slight_smile:

Many Thanks

Ok I think I managed to get them to load. I was having an issue where the SCK clock change command was not taking effect.

My platformio install had an older version of avrdude that was causing the issue. I downloaded avrdude 6.3 and the related config file linked in the github repo page and replaced the one that was in my platformio install. For me this was located in: C:\Users\marv.platformio\packages\tool-avrdude

I then updated the platformio.ini file to have the B16 flag as it wouldnt load without this. It looked like this:
upload_flags =

Clicking upload now works and the devices flashes the fuses and hex file as expected.

I still need to check the 421 version is the correct one for the leaf module but at least now it can flash the chip.