Community
OpenEnergyMonitor

OpenEnergyMonitor Community

Can't flash cell modules... Platform IO/UsbAsp [upload] Error 1

Finally got all my boards from jlcpcb. Soldered on the Attiny841-ssu on to 7 of the cell modules including jst connectors etc… triple check checked all my solder joints etc…

Following @stuart tutorials on YouTube, flashing the controller PCB went well without a hitch. Then I attempted to flash the cell modules oh, and no matter what I try platform IO errors out with Error 1.

Also when platform IO attempts to flash the cell modules, as soon as it initialises and tries to flash it the LED on the cell module itself briefly blinks and immediately afterwards platform IO fails.

These are all of the things I checked and tried:

*Made sure my USB asp is set to 3.3v (also tried 5v… may have fried that board. Idk)

  • tried to short jumper 3 on the usbasp to enable slower flashing
  • reinstall the newest driver for Windows 10 for the usbasp
  • checked the firmware readme file for usbasp and verified it is compatible with Attiny841
  • tried newer and older avrdude versions
  • verified pin one of the connector from the usbasp was connected to the right pin of the cell module etc…
  • probably forgetting a few other things…

I attempted two flash 4 different cell modules just in case one of them was faulty

I will try to post the contents of the platform IO terminal, below. If I am unable to I will include a link to pastebin.

I appreciate any help you can provide. Thank you

Platform IO terminal error output below. For some reason to put the entire string and one line. Here is a link to pastebin also:

> Executing task in folder ATTINYCellModule: C:\Users\CoOp\.platformio\penv\Scripts\platformio.exe run --target upload --environment attiny841_V421 < Processing attiny841_V421 (platform: atmelavr; board: attiny841; framework: arduino) -------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/attiny841.html PLATFORM: Atmel AVR (2.2.0) > Generic ATtiny841 HARDWARE: ATTINY841 8MHz, 512B RAM, 8KB Flash PACKAGES: - framework-arduino-avr-attiny 1.3.2 - tool-avrdude 1.60300.200527 (6.3.0) - toolchain-atmelavr 1.50400.190710 (5.4.0) LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf LDF Modes: Finder ~ chain, Compatibility ~ soft Found 14 compatible libraries Scanning dependencies... Dependency Graph |-- <PacketSerial> 1.4.0+sha.840272c |-- <FastPID> 1.3.1+sha.1792d23 |-- <settings> |   |-- <crc16> |   |-- <EEPROM> 2.0 |-- <crc16> |-- <Steinhart> Building in release mode Checking size .pio\build\attiny841_V421\firmware.elf Advanced Memory Usage is available via "PlatformIO Home > Project Inspect" RAM:   [=======   ]  70.5% (used 361 bytes from 512 bytes) Flash: [==========]  95.4% (used 7816 bytes from 8192 bytes) Configuring upload protocol... AVAILABLE: usbasp CURRENT: upload_protocol = usbasp Looking for upload port... Uploading .pio\build\attiny841_V421\firmware.hex avrdude: Version 6.3-20171130          Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/          Copyright (c) 2007-2014 Joerg Wunsch          System wide configuration file is "C:\Users\CoOp\.platformio\packages\tool-avrdude\avrdude.conf"          Using Port                    : usb          Using Programmer              : usbasp          Setting bit clk period        : 16.0 avrdude: seen device from vendor ->www.fischl.de<- avrdude: seen product ->USBasp<-          AVR Part                      : ATtiny841          Chip Erase delay              : 4500 us          PAGEL                         : P00          BS2                           : P00          RESET disposition             : possible i/o          RETRY pulse                   : SCK          serial program mode           : yes          parallel program mode         : yes          Timeout                       : 200          StabDelay                     : 100          CmdexeDelay                   : 25          SyncLoops                     : 32          ByteDelay                     : 0          PollIndex                     : 3          PollValue                     : 0x53          Memory Detail                 :                                   Block Poll               Page                       Polled            Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack            ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------            eeprom        65     6     4    0 no        512    4      0  4000  4500 0xff 0xff            signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00            lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00            lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00            hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00            calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00            flash         65     6    16    0 yes      8192   16    512  4500  4500 0xff 0xff            efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00          Programmer Type : usbasp          Description     : USBasp, http://www.fischl.de/usbasp/ avrdude: try to set SCK period to 1.6e-05 s (= 62500 Hz) avrdude: set SCK frequency to 32000 Hz avrdude: warning: cannot set sck period. please check for usbasp firmware update. avrdude: error: program enable: target doesn't answer. 1 avrdude: initialization failed, rc=-1          Double check connections and try again, or use -F to override          this check. avrdude done.  Thank you. *** [upload] Error 1 ============================================== [FAILED] Took 2.12 seconds ============================================== Environment     Status    Duration --------------  --------  ------------ attiny841_V421  FAILED    00:00:02.122 ========================================= 1 failed, 0 succeeded in 00:00:02.122 =========================================The terminal process "C:\Users\CoOp\.platformio\penv\Scripts\platformio.exe 'run', '--target', 'upload', '--environment', 'attiny841_V421'" terminated with exit code: 1. Terminal will be reused by tasks, press any key to close it.

Doing a little research and I think my problem is pinout of the usbasp does not match the pinout on the controller module in order to program the Attiny841-ssu.

At first in Stuart’s video I seen he was using a 10 pin connector from the usbasp in that pin one of the connector was connected to pin one of the control module and I made sure I did the same. But now that I think back on it he had rewired the ribbon cable on to the usbasp itself. And I did not I just used it the way it was set up from the factory. The ribbon cable is plugged into the connector on the usbasp and I just took the other end with the 10 pin connector and put pin one to pin one of the controller module just assuming that it was correct.

So when I get home from work I will verify which wire goes to what pin. I just found a schematic of the wiring diagram from the usbasp to the attiny841.

Below is a photo of the schematic of my usbasp factory 10 pin connector if anyone knows off hand if it is wired correctly or not to join up to the controller module without changing anything

I just hope if the wires are wrong I didn’t burn up 5 different attiny841’s this morning trying to get it to work😞

Now that I’m looking at the photo I can see why it’s not working LOL.

Pin 7 - SCK is not connected to the controller module PCB since it only has a 6pin connector

Hi, most usbasp have the old style 10 pin connector, I just worked out what pins were which and connected the 6 pins needed.

Some usbasp come with an adapter board.

As long as you didn’t exceed 5 volt, the chips will be fine.

1 Like

Well i finally got it working !!! YAY…

Ive been troubleshooting and working on getting the cell modules programmed all night long. No sleep. Literally over 30+ chrome tabs open, tried 5 different versions of avrdude also adding custom code to avrdude, etc…

Guess what the problem was.?.?.?

A set of 4 female dupont wires I had didn’t have continuity!!! WTF… that also explains why a few of my breadboard diy circuits weren’t working recently etc…

OMG…

Hopefully people can get something out of this…

If your trying to program the diybms cell modules using a USBasp and keep getting a Error 1 or the signature of the attiny841 doesnt match the expected signature etc, CHECK YOUR WIRING AND CHECK FOR CONTINUITY!!!
Dont trust these cheap garbage premade dupont connectors

1 Like