Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 13:06 02 May 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Electronics : Mab1's wiseguy inverter build - transformer options

     Page 5 of 6    
Author Message
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1816
Posted: 01:10am 25 Apr 2025
Copy link to clipboard 
Print this post

Actually we are going around in circles here:

1: The USbasp programmer does not have anything to do with the Nano USB port and driver, does need it in any way.

2: The programmer bypasses the USB port and talks directly to the Nano processor via the 6 pin ICSP header.

3: If ArvDudess can not expose the USB option in the Port[-P] drop down box, it means that AvrDudess is not communicating with the underlying iMac OS USB devices.

The IDE appears to be seeing the Programmer and is getting an ID back, that is the typical warning about device type though, so it looks like the USbasp driver is working.

I sent you a PM.

EDIT:

If you can run the following command it should tell us a few things:
I assume I have the path to your hex program file correct see the download at the bottom.

avrdude -c usbasp-clone -p m328 -P usb -b 57600 -F -v -v -U flash:w:"/Users/marcus/Downloads/NanosetupInfo/KeepIS.hex":i


NOTE: You do not need the Programmer connected to anything, No need for a Nano, just plug the programmer into the iMac USB port.

If you can run the command, it will allow avrdude to go through the programming and verification sequence and confirm if the Programmer and driver are working, the driver you have installed is the correct driver, it has the same driver signature as my Windows driver.

To make this easier download the following Zip, place the three files in a Directory, then try and run the command - I don't know how you do that on iMac, the command line is included in the text file in the download.

The download contains a later version of avrdude and required avrdude config file, the command will not work with the older versions installed with the IDE.    

RunThis    

.
Edited 2025-04-25 16:40 by KeepIS
NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
mab1
Senior Member

Joined: 10/02/2015
Location: United Kingdom
Posts: 237
Posted: 09:21pm 25 Apr 2025
Copy link to clipboard 
Print this post

OK, I followed your 1st instruction first from the open Terminal window - i hope that is what you intended,rather than running it from within avrdudess? (various attempts to make it work):-



then using the files in your zip:-



doesn't seem to run, although i thought it did run from within avrdudess.

Edit:
I'm just wondering: because i have to run avrdudess within 'mono' .net framework thingy, is the problem actually that mono doesn't allow access to usb ports? not that that gets me any closer  
Edited 2025-04-26 07:41 by mab1
 
mab1
Senior Member

Joined: 10/02/2015
Location: United Kingdom
Posts: 237
Posted: 10:50pm 25 Apr 2025
Copy link to clipboard 
Print this post

OK, had a though about what you were saying that averdude must run on the mac (without mono) for the IDE to function, so looked for the command line in the previously posted IDE attempt to use the USBasp:-

/Users/marcus/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude -C/Users/marcus/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf -v -p atmega328p -c usbasp -P usb -U flash:w:/var/folders/2s/n4lnvcqs55g0zlsbjg2tlsl80000gp/T/arduino_build_174515/Blink.ino.hex:i


so what happens if i graft in the path to the .hex file we want:-

/Users/marcus/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude -C/Users/marcus/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf -v -p atmega328p -c usbasp -P usb -U flash:w:/Users/marcus/Downloads/NanosetupInfo/KeepIS.hex:i


paste that into Terminal and:-

Macintosh-4:~ marcus$ /Users/marcus/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude -C/Users/marcus/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf -v -p atmega328p -c usbasp -P usb -U flash:w:/Users/marcus/Downloads/NanosetupInfo/KeepIS.hex:i

avrdude: Version 6.3-20190619
        Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
        Copyright (c) 2007-2014 Joerg Wunsch

        System wide configuration file is "/Users/marcus/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf"
        User configuration file is "/Users/marcus/.avrduderc"
        User configuration file does not exist or is not a regular file, skipping

        Using Port                    : usb
        Using Programmer              : usbasp
        AVR Part                      : ATmega328P
        Chip Erase delay              : 9000 us
        PAGEL                         : PD7
        BS2                           : PC2
        RESET disposition             : dedicated
        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    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
          flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
          lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
          hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
          efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
          lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
          calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
          signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

        Programmer Type : usbasp
        Description     : USBasp, http://www.fischl.de/usbasp/

avrdude: auto set sck period (because given equals null)
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9516 (probably m328pb)
avrdude: Expected signature for ATmega328P is 1E 95 0F
        Double check chip, or use -F to override this check.

avrdude done.  Thank you.

Macintosh-4:~ marcus$


Wellthat's definitly promising,but it's still detecting that the nanois a 328pb - so try:

/Users/marcus/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude -C/Users/marcus/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf -v -p m328pb -c usbasp -P usb -U flash:w:/Users/marcus/Downloads/NanosetupInfo/KeepIS.hex:i


Macintosh-4:~ marcus$ /Users/marcus/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude -C/Users/marcus/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf -v -p m328pb -c usbasp -P usb -U flash:w:/Users/marcus/Downloads/NanosetupInfo/KeepIS.hex:i

avrdude: Version 6.3-20190619
        Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
        Copyright (c) 2007-2014 Joerg Wunsch

        System wide configuration file is "/Users/marcus/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf"
        User configuration file is "/Users/marcus/.avrduderc"
        User configuration file does not exist or is not a regular file, skipping

        Using Port                    : usb
        Using Programmer              : usbasp
        AVR Part                      : ATmega328PB
        Chip Erase delay              : 9000 us
        PAGEL                         : PD7
        BS2                           : PC2
        RESET disposition             : dedicated
        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    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
          flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
          lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
          hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
          efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
          lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
          calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
          signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

        Programmer Type : usbasp
        Description     : USBasp, http://www.fischl.de/usbasp/

avrdude: auto set sck period (because given equals null)
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9516 (probably m328pb)
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as FD
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: auto set sck period (because given equals null)
avrdude: reading input file "/Users/marcus/Downloads/NanosetupInfo/KeepIS.hex"
avrdude: can't open input file /Users/marcus/Downloads/NanosetupInfo/KeepIS.hex: No such file or directory
avrdude: read from file '/Users/marcus/Downloads/NanosetupInfo/KeepIS.hex' failed

avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as FD
avrdude: safemode: Fuses OK (E:FD, H:DA, L:FF)

avrdude done.  Thank you.

Macintosh-4:~ marcus$


Gaah! I feel I'm close!
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1816
Posted: 10:59pm 25 Apr 2025
Copy link to clipboard 
Print this post

Just got to the computer, the terminology is throwing me slightly.

The text I sent is a command line argument that is passed to avrdude to process and run.

For this to happen, and this is where I have no idea what the iMac OS limitation is in this case, I will tell you what is meant to happen.

In Windows, you would place the 3 files I zipped into a directory, you would then open a command line window, and copy the command from RunThis.txt into the command window and press enter.

avrdude.exe (which is inside the directory) will run, I don't have to tell the OS where avrdude.exe is located, it assumes that it's in the current directory, avrdude will run and will look first in the current director that it launched from for the config file and process the entered command line argument.

Also in windows, you could rename the file "RunThis.txt" to RunThis.bat and simply run it, the .BAT extension (batch file), automatically passes the command to the command interpreter.  

Without knowing how your OS processes a command or the structure of the command or the registration of programs to the OS makes it difficult.

What I was trying to do was to remove the GUI interface program called AveDudess from the process, as it having trouble finding the programmer - IE it's not working correctly, but we have already proved that the command line program avrdude.exe can work.
NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
mab1
Senior Member

Joined: 10/02/2015
Location: United Kingdom
Posts: 237
Posted: 11:00pm 25 Apr 2025
Copy link to clipboard 
Print this post

OK, the filename was wrong   :-
/Users/marcus/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude -C/Users/marcus/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf -v -p m328pb -c usbasp -P usb -U flash:w:/Users/marcus/Downloads/NanosetupInfo/KeepISinv.hex:i


result:-
Macintosh-4:~ marcus$ /Users/marcus/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude -C/Users/marcus/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf -v -p m328pb -c usbasp -P usb -U flash:w:/Users/marcus/Downloads/NanosetupInfo/KeepISinv.hex:i

avrdude: Version 6.3-20190619
        Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
        Copyright (c) 2007-2014 Joerg Wunsch

        System wide configuration file is "/Users/marcus/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf"
        User configuration file is "/Users/marcus/.avrduderc"
        User configuration file does not exist or is not a regular file, skipping

        Using Port                    : usb
        Using Programmer              : usbasp
        AVR Part                      : ATmega328PB
        Chip Erase delay              : 9000 us
        PAGEL                         : PD7
        BS2                           : PC2
        RESET disposition             : dedicated
        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    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
          flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
          lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
          hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
          efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
          lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
          calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
          signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

        Programmer Type : usbasp
        Description     : USBasp, http://www.fischl.de/usbasp/

avrdude: auto set sck period (because given equals null)
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9516 (probably m328pb)
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as FD
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: auto set sck period (because given equals null)
avrdude: reading input file "/Users/marcus/Downloads/NanosetupInfo/KeepISinv.hex"
avrdude: writing flash (29276 bytes):

Writing | ################################################## | 100% 9.41s

avrdude: 29276 bytes of flash written
avrdude: verifying flash memory against /Users/marcus/Downloads/NanosetupInfo/KeepISinv.hex:
avrdude: load data flash data from input file /Users/marcus/Downloads/NanosetupInfo/KeepISinv.hex:
avrdude: input file /Users/marcus/Downloads/NanosetupInfo/KeepISinv.hex contains 29276 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 8.94s

avrdude: verifying ...
avrdude: 29276 bytes of flash verified

avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as FD
avrdude: safemode: Fuses OK (E:FD, H:DA, L:FF)

avrdude done.  Thank you.

Macintosh-4:~ marcus$


Well it isn't blinking anymore, I still can't set the fuses, and i guess the bootloader is still there(?), but it looks like i might have got the hex file loaded?

Edit: just saw your post mike - yes,i finally caught up with what you were saying   . just wondering if what the next step is  
Edited 2025-04-26 09:04 by mab1
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1816
Posted: 11:06pm 25 Apr 2025
Copy link to clipboard 
Print this post

OK you are close, you need to put -F before -V to override chip detection, and the system is using the existing version of avrdude that was installed by the IDE.

WAIT, that look like it programmed, 100% verification and correct size.

Hook up a terminal program to the USB port on the nano and see if you can get the menu
.
Edited 2025-04-26 09:09 by KeepIS
NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
mab1
Senior Member

Joined: 10/02/2015
Location: United Kingdom
Posts: 237
Posted: 11:14pm 25 Apr 2025
Copy link to clipboard 
Print this post

Macintosh-4:~ marcus$ /Users/marcus/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude -C/Users/marcus/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf -F -v -p m328pb -c usbasp -P usb -U flash:w:/Users/marcus/Downloads/NanosetupInfo/KeepISinv.hex:i

avrdude: Version 6.3-20190619
        Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
        Copyright (c) 2007-2014 Joerg Wunsch

        System wide configuration file is "/Users/marcus/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf"
        User configuration file is "/Users/marcus/.avrduderc"
        User configuration file does not exist or is not a regular file, skipping

        Using Port                    : usb
        Using Programmer              : usbasp
        AVR Part                      : ATmega328PB
        Chip Erase delay              : 9000 us
        PAGEL                         : PD7
        BS2                           : PC2
        RESET disposition             : dedicated
        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    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
          flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
          lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
          hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
          efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
          lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
          calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
          signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

        Programmer Type : usbasp
        Description     : USBasp, http://www.fischl.de/usbasp/

avrdude: auto set sck period (because given equals null)
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9516 (probably m328pb)
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as FD
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: auto set sck period (because given equals null)
avrdude: reading input file "/Users/marcus/Downloads/NanosetupInfo/KeepISinv.hex"
avrdude: writing flash (29276 bytes):

Writing | ################################################## | 100% 9.42s

avrdude: 29276 bytes of flash written
avrdude: verifying flash memory against /Users/marcus/Downloads/NanosetupInfo/KeepISinv.hex:
avrdude: load data flash data from input file /Users/marcus/Downloads/NanosetupInfo/KeepISinv.hex:
avrdude: input file /Users/marcus/Downloads/NanosetupInfo/KeepISinv.hex contains 29276 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 8.98s

avrdude: verifying ...
avrdude: 29276 bytes of flash verified

avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as FD
avrdude: safemode: Fuses OK (E:FD, H:DA, L:FF)

avrdude done.  Thank you.

Macintosh-4:~ marcus$  


Thanks - Is that better?

Edit: - oh! i've already reprogrammed with -F  

OK... where's the usb lead?...
Edited 2025-04-26 09:18 by mab1
 
mab1
Senior Member

Joined: 10/02/2015
Location: United Kingdom
Posts: 237
Posted: 11:29pm 25 Apr 2025
Copy link to clipboard 
Print this post

Umm...is it ? to get the menu?

I get this as a response:




Edit:
Wrong baud rate!







edit:
actually,  feels a bit tame - i feel more like:
       
Edited 2025-04-26 09:36 by mab1
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1816
Posted: 11:45pm 25 Apr 2025
Copy link to clipboard 
Print this post

So glad to see it going, Ideally, we should get the fuses set and the boot loader removed.  

However you should be able to test the boards and it will run. Just have a look at the help file for how to use the Menu.

Basically, you don't press Enter at all, enter key is only used to accept a voltage or current value typed in if the Menu asks you to do that.

You also need Local Echo on in the terminal application to see the keys you press, the Nano Menu does not ECHO back your key strokes to the Terminal program.

IE without having local Echo on, you wont see anything you enter - it will look like the Nano is not responding to you  
NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
mab1
Senior Member

Joined: 10/02/2015
Location: United Kingdom
Posts: 237
Posted: 12:07am 26 Apr 2025
Copy link to clipboard 
Print this post

Thanks for your patience whilst we muddled through this   . Trouble is i don't know much about mac OS either - and my windows knowledge isn't particularly deep, and years out of date (still remember using MS dos). To be fair to the mac, most things just work, but when they don't, i'm all at sea.

Time for bed for me, but i'll plug the nano into the inverter board and proceed with testing and cals.

I might have another play with the winxp machine: avrdudess would run but not avrdude (but the arduino ide works on that OS too IIRC).

Cheers
Marcus
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1816
Posted: 12:19am 26 Apr 2025
Copy link to clipboard 
Print this post

With XP it will be the driver for the programmer, I will look to see if there is a version for XP, I'm sure I saw one a while back, from memory the IDE uses two different applications to program, so it would work for USB programming but likely fail when directed to us a Programmer.

BTW the Menu display you posted was in Simple Menu mode, pressing Z will reveal the full menu.

You can sleep well now    
.
Edited 2025-04-26 10:21 by KeepIS
NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2407
Posted: 12:26am 26 Apr 2025
Copy link to clipboard 
Print this post

  Quote   Ideally, we should get the fuses set and the boot loader removed.
If the reason for doing this is to prevent unwanted toggling of the Reset pin scrambling the program just tying the Reset pin high may be enough.

When using a Nano to program PIC32 chips (via pic32prog.exe) this is the method has always worked for me.
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1816
Posted: 02:34am 26 Apr 2025
Copy link to clipboard 
Print this post

That is a good point you make, so sorry for my longish reply, but I just wanted to let others know the overly cautious frame of mind I'm in when it comes to the Controller in my Inverter.
   
That could be done via a jumper on the ICSP pins, and removed when an ICSP Programmer is connected. I believe POR would be enabled which could possibly screw up with with a boot loader under the right supply noise conditions, or maybe not, but if it's not there it can't.

From everything I have read, the boot loader appears to be the main cause of code corruption, assuming the Hardware and interfaces are correct, usually by the USB interface route, which I hardware disable on the Nano, including +5V.

The last thing I want is a reset or injection of any voltage into the Inverter Controllers 5V rail - even via a diode.

I don't loose any sleep at night knowing the boot loader is gone, I would if it was there. I'm not taking the chance, even if it's almost zero, not with so much destructive power on tap in the device it's controlling.        

I'm also close to program limits and as there is no need for a boot loader, the extra 5% of headroom is nice - likely just my feel good mentality

The Fuses need modifying to stop EEprom data "Inverter settings" from being overwritten when Nano Flash is erased or uploading Code to the Nano, it's not set by default in any of the Nano boards I have tested.

Now that Marcus has the command line working, fuses are easy to set with another command line argument.

BTW It annoys me that the Arduino IDE, with programmer board selected, resets fuses and adds a boot loader, unless you manually modify the board Device programing parameters for the selected Part in the bowels of the IDE, which likely gets overwritten with every new update.
Edited 2025-04-26 12:34 by KeepIS
NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1816
Posted: 05:57am 26 Apr 2025
Copy link to clipboard 
Print this post

I have found a version for older Window OS, Win7 and earlier.

Older versions

This includes Zadig-2.7 which might install the correct driver for the Programmer, look at the readme.txt I included.

If that does not work then a driver in the "ISP Driver" folder can be tried, it's a Win 32 driver which can be installed manually, usually right click on the usbasp.inf file and click Install.

And as a last resort for old Windows, here is a full install with instructions of an old version of avrdude and avrdudess and the driver.

Old Win full for usbasp programmer.

Good luck
.
Edited 2025-04-26 16:18 by KeepIS
NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1816
Posted: 11:13pm 26 Apr 2025
Copy link to clipboard 
Print this post

Here are the Fuse and Lock Settings, obviously send these one at a time, you only need to do these once providing you Never let the Arduino IDE anywhere near the Programmer with the Nano.  

-c usbasp -p m328pb -P usb -b 57600 -F -v -v -U lock:w:0xFF:m

-c usbasp -p m328pb -P usb -b 57600 -F -v -v -U lfuse:w:0xFF:m -U hfuse:w:0xD7:m -U efuse:w:0xFD:m


I have made the following commands conform to your version of Avrdude and the iMac command, same as when you programmed the Hex code - I hope it's right.

Macintosh-4:~ marcus$ /Users/marcus/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude -C/Users/marcus/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf -c usbasp -p m328pb -P usb -b 57600 -F -v -v -U lock:w:0xFF:m

Macintosh-4:~ marcus$ /Users/marcus/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude -C/Users/marcus/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf -c usbasp -p m328pb -P usb -b 57600 -F -v -v -U lfuse:w:0xFF:m -U hfuse:w:0xD7:m -U efuse:w:0xFD:m

NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
mab1
Senior Member

Joined: 10/02/2015
Location: United Kingdom
Posts: 237
Posted: 08:30pm 27 Apr 2025
Copy link to clipboard 
Print this post

Thanks very much! I fear you're doing a lot of work to help me with my obsolete computers.

As I had the working nano, I was doing electronics testing with it on my inverter boards yesterday (found a fault on the powerboard - highside out A not turning on - investigating).

Today I've got XP running and seeing if I can get avrdude.exe to actually run on it (I do have a version of the ide installed, but it falls over when you actually try and compile/verify, let alone program, so I'm following your links, and looking for old versions of the ide...

But I will try your command lines on the mac too when it's on: just curious - will they remove the bootloader if it's already loaded?  do they remove the protection for the bootloaded if it's there?

On the same vein: If I start with a fresh nano (not knowing if it has the bootloader already), do I do the fuse commands first, then upload the hex, or does the order not matter?
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1816
Posted: 10:25pm 27 Apr 2025
Copy link to clipboard 
Print this post

I don't mind at all, never know, it might be of help to someone else on the Forum.

It was helpful for me as well, during the process I decided to just make 3 batch files, 1 for setting the Fuses in a new Nano, the second to program Standard Inverter code and third to Program Dual Inverter code. Just a click on the Desktop to run them, way faster than launching AvrDudess and selecting the file, don't know why I did not do it before    

The boot loader is programmed into the Nano unless stated otherwise when you purchase it.

The two Fuse commands remove the boot loader write protect and stop your Inverter settings in EEprom being overwritten should you have to reprogram the Nano for any future Code updates, Just don't use the IDE to program, even with the PGM board.

On a new Nano upload the fuse commands first, that way you know it's correct for the other settings.

BTW the iMac seems just fine for this task  

As long as you keep the voltage around 15v in Test mode and current limit to few hundred mA, you should be right to fault find without damaging any FETS  

Wiseguy wrote a very good PDF for initial Test setup with expected currents for each part of the testing stages, it's in his Inverter thread towards the end in case you haven't seen it.

He is always willing to help if you run into trouble, as are the rest of us who are here, but sometimes "too many cooks spoil the broth"  
.
Edited 2025-04-28 09:54 by KeepIS
NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
mab1
Senior Member

Joined: 10/02/2015
Location: United Kingdom
Posts: 237
Posted: 08:52pm 28 Apr 2025
Copy link to clipboard 
Print this post

Still working on avrdudess on winXP   : getting closer i think, but not there yet...

The fault on the WG30 power board appears to be a failed 12v isolated psu, but am not sure if it's failed for a reason yet - it's output is not shorted, but i need to verify using a bench psu that there's no shorts when the opto goes high...

Macintosh-4:~ marcus$ /Users/marcus/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude -C/Users/marcus/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf -c usbasp -p m328pb -P usb -b 57600 -F -v -v -U lock:w:0xFF:m

avrdude: Version 6.3-20190619
        Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
        Copyright (c) 2007-2014 Joerg Wunsch

        System wide configuration file is "/Users/marcus/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf"
        User configuration file is "/Users/marcus/.avrduderc"
        User configuration file does not exist or is not a regular file, skipping

        Using Port                    : usb
        Using Programmer              : usbasp
        Overriding Baud Rate          : 57600
avrdude: seen device from vendor ->www.fischl.de<-
avrdude: seen product ->USBasp<-
        AVR Part                      : ATmega328PB
        Chip Erase delay              : 9000 us
        PAGEL                         : PD7
        BS2                           : PC2
        RESET disposition             : dedicated
        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    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
          flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
          lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
          hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
          efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
          lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
          calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
          signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

        Programmer Type : usbasp
        Description     : USBasp, http://www.fischl.de/usbasp/

avrdude: auto set sck period (because given equals null)
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9516 (probably m328pb)
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as FD
avrdude: reading input file "0xFF"
avrdude: writing lock (1 bytes):

Writing |                                                    | 0% 0.00s ***failed;  
Writing | ################################################## | 100% 0.05s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0xFF:
avrdude: load data lock data from input file 0xFF:
avrdude: input file 0xFF contains 1 bytes
avrdude: reading on-chip lock data:

Reading | ################################################## | 100% 0.00s

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

avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as FD
avrdude: safemode: Fuses OK (E:FD, H:DA, L:FF)

avrdude done.  Thank you.

Macintosh-4:~ marcus$

Hmm... not so easy alas -  

/Users/marcus/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude -C/Users/marcus/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf -c usbasp -p m328pb -P usb -b 57600 -F -v -v -U lfuse:w:0xFF:m -U hfuse:w:0xD7:m -U efuse:w:0xFD:m

avrdude: Version 6.3-20190619
        Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
        Copyright (c) 2007-2014 Joerg Wunsch

        System wide configuration file is "/Users/marcus/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf"
        User configuration file is "/Users/marcus/.avrduderc"
        User configuration file does not exist or is not a regular file, skipping

        Using Port                    : usb
        Using Programmer              : usbasp
        Overriding Baud Rate          : 57600
avrdude: seen device from vendor ->www.fischl.de<-
avrdude: seen product ->USBasp<-
        AVR Part                      : ATmega328PB
        Chip Erase delay              : 9000 us
        PAGEL                         : PD7
        BS2                           : PC2
        RESET disposition             : dedicated
        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    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
          flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
          lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
          hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
          efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
          lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
          calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
          signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

        Programmer Type : usbasp
        Description     : USBasp, http://www.fischl.de/usbasp/

avrdude: auto set sck period (because given equals null)
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9516 (probably m328pb)
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as FD
avrdude: reading input file "0xFF"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xFF:
avrdude: load data lfuse data from input file 0xFF:
avrdude: input file 0xFF contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified
avrdude: reading input file "0xD7"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xD7:
avrdude: load data hfuse data from input file 0xD7:
avrdude: input file 0xD7 contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xFD"
avrdude: writing efuse (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0xFD:
avrdude: load data efuse data from input file 0xFD:
avrdude: input file 0xFD contains 1 bytes
avrdude: reading on-chip efuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of efuse verified

avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as D7
avrdude: safemode: efuse reads as FD
avrdude: safemode: Fuses OK (E:FD, H:D7, L:FF)

avrdude done.  Thank you.

Macintosh-4:~ marcus$


Looks like the fuses have worked   (although l and e were right anyway, i think).
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1816
Posted: 09:50pm 28 Apr 2025
Copy link to clipboard 
Print this post

Have you tried the first one a second time, I've seen this happen before, I even included in the Help notes on programming the Lock bits. It should be fine in any case.
NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
mab1
Senior Member

Joined: 10/02/2015
Location: United Kingdom
Posts: 237
Posted: 10:36pm 28 Apr 2025
Copy link to clipboard 
Print this post

Yes, i tried twice,and just tried twice (in a row) again,and got the same result... except, on the 2nd go there's a warning:-
...
Writing |                                                    | 0% 0.00s ***failed;  
Writing | ################################################## | 100% 0.05s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0xFF:
avrdude: load data lock data from input file 0xFF:
avrdude: input file 0xFF contains 1 bytes
avrdude: reading on-chip lock data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: WARNING: invalid value for unused bits in fuse "lock", should be set to 1 according to datasheet
This behaviour is deprecated and will result in an error in future version
You probably want to use 0x3f instead of 0xff (double check with your datasheet first).
avrdude: 1 bytes of lock verified

avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as D7
avrdude: safemode: efuse reads as FD
avrdude: safemode: Fuses OK (E:FD, H:D7, L:FF)

avrdude done.  Thank you.


do you think i should try 0x3F as it recomends?

in the original 'fail' above the verify readback shows it as 0x0F, which is different from the 0xCF in your pdf (the two greyed out bits 'set'?)
Edited 2025-04-29 08:41 by mab1
 
     Page 5 of 6    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025