becky001 / Raspberry-Pi-UPDI-Stand-Alone-Programmer

4 stars 2 forks source link

UPDI Code #1

Open netkruzer opened 2 years ago

netkruzer commented 2 years ago

Did you delete your python script from this repo? Does this layout/wiring work? I'm thinking of using this for programming an Attiny on my Raspberry Pi connected PCB.

becky001 commented 2 years ago

Actually I didn't upload on the repo.  Yes, layout/wiring works.  I use it all the time. Thank you for your interest.  If you are really interest, I will check in the code.  (first I will look for it)

-----Original Message----- From: Kevin Jordan @.> To: becky001/Raspberry-Pi-UPDI-Stand-Alone-Programmer @.> Cc: Subscribed @.***> Sent: Tue, Jan 11, 2022 8:09 pm Subject: [becky001/Raspberry-Pi-UPDI-Stand-Alone-Programmer] UPDI Code (Issue #1)

Did you delete your python script from this repo? Does this layout/wiring work? I'm thinking of using this for programming the Mycroft Attiny.— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you are subscribed to this thread.Message ID: @.***>

netkruzer commented 2 years ago

I ended up figuring it out. The problem on the Raspberry Pi 4B connecting to UPDI, it defaults to having the UART as a console to the OS and connected to bluetooth and that blocks the UPDI from working. Needed to turn the console off via UART, turn on UART (both from raspi-config) and then turn off bluetooth (disable-bt in /boot/config.txt). Then it works flashing a Attiny404 from Arduino-cli.

The wiring you have works, but I ended up just using a 1k resistor and that worked too.

These steps are more for my use, but maybe someone else might find it useful, and definitely for when I forget what I did in a few months:

At the end of /boot/config.txt

enable_uart=1
# Disable Bluetooth
dtoverlay=disable-bt

/boot/cmdline.txt

console=tty1 root=PARTUUID=18ff64a8-02 rootfstype=ext4 fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles

run these commands:

sudo systemctl disable hciuart.service
sudo systemctl disable bluealsa.service
sudo systemctl disable bluetooth.service

Install arduino-cli, install Spence Konde's MegaTinyCore, then run :

pi@raspberrypi:~/Arduino/mycroft_mark2_test $ sudo /home/pi/bin/arduino-cli burn-bootloader -b megaTinyCore:megaavr:atxy4:chip=404 --programmer serialupdi57k -p /dev/ttyAMA0
SerialUPDI
UPDI programming for Arduino using a serial adapter
Based on pymcuprog, with significant modifications
By Quentin Bolsee and Spence Konde
Version 1.2.0 - June 2021
Using serial port /dev/ttyAMA0 at 57600 baud.
Target: attiny404
Set fuses: ['0:0x00', '1:0x00', '2:0x02', '5:0b11000101', '6:0x04', '7:0x00', '8:0x00']
Action: erase
Pinging device...
Ping response: 1E9226
Setting fuse 0x0=0x0
Writing literal values...
Verifying literal values...
Action took 0.03s
Setting fuse 0x1=0x0
Writing literal values...
Verifying literal values...
Action took 0.03s
Setting fuse 0x2=0x2
Writing literal values...
Verifying literal values...
Action took 0.03s
Setting fuse 0x5=0xc5
Writing literal values...
Verifying literal values...
Action took 0.03s
Setting fuse 0x6=0x4
Writing literal values...
Verifying literal values...
Action took 0.03s
Setting fuse 0x7=0x0
Writing literal values...
Verifying literal values...
Action took 0.03s
Setting fuse 0x8=0x0
Writing literal values...
Verifying literal values...
Action took 0.03s
Finished writing fuses.
Chip/Bulk erase,
Memory type eeprom is conditionally erased (depending upon EESAVE fuse setting)
Memory type flash is always erased
Memory type lockbits is always erased
...
Erased.
Action took 0.01s

Thanks for posting this GitHub, it helped me in the right direction.

becky001 commented 2 years ago

cool

-----Original Message----- From: Kevin Jordan @.> To: becky001/Raspberry-Pi-UPDI-Stand-Alone-Programmer @.> Cc: becky001 @.>; Comment @.> Sent: Thu, Jan 13, 2022 6:58 pm Subject: Re: [becky001/Raspberry-Pi-UPDI-Stand-Alone-Programmer] UPDI Code (Issue #1)

I ended up figuring it out. The problem on the Raspberry Pi 4B connecting to UPDI, it defaults to having the UART as a console to the OS and connected to bluetooth and that blocks the UPDI from working. Needed to turn the console off via UART, turn on UART (both from raspi-config) and then turn off bluetooth (disable-bt in /boot/config.txt). Then it works flashing a Attiny404 from Arduino-cli.The wiring you have works, but I ended up just using a 1k resistor and that worked too.These steps are more for my use, but maybe someone else might find it useful, and definitely for when I forget what I did in a few months:At the end of /boot/config.txtenable_uart=1

Disable Bluetooth

dtoverlay=disable-bt /boot/cmdline.txtconsole=tty1 root=PARTUUID=18ff64a8-02 rootfstype=ext4 fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles run these commands:sudo systemctl disable hciuart.service sudo systemctl disable bluealsa.service sudo systemctl disable bluetooth.service

Install arduino-cli, install Spence Konde's MegaTinyCore, then run @.:~/Arduino/mycroft_mark2_test $ sudo /home/pi/bin/arduino-cli burn-bootloader -b megaTinyCore:megaavr:atxy4:chip=404 --programmer serialupdi57k -p /dev/ttyAMA0 SerialUPDI UPDI programming for Arduino using a serial adapter Based on pymcuprog, with significant modifications By Quentin Bolsee and Spence Konde Version 1.2.0 - June 2021 Using serial port /dev/ttyAMA0 at 57600 baud. Target: attiny404 Set fuses: ['0:0x00', '1:0x00', '2:0x02', '5:0b11000101', '6:0x04', '7:0x00', '8:0x00'] Action: erase Pinging device... Ping response: 1E9226 Setting fuse 0x0=0x0 Writing literal values... Verifying literal values... Action took 0.03s Setting fuse 0x1=0x0 Writing literal values... Verifying literal values... Action took 0.03s Setting fuse 0x2=0x2 Writing literal values... Verifying literal values... Action took 0.03s Setting fuse 0x5=0xc5 Writing literal values... Verifying literal values... Action took 0.03s Setting fuse 0x6=0x4 Writing literal values... Verifying literal values... Action took 0.03s Setting fuse 0x7=0x0 Writing literal values... Verifying literal values... Action took 0.03s Setting fuse 0x8=0x0 Writing literal values... Verifying literal values... Action took 0.03s Finished writing fuses. Chip/Bulk erase, Memory type eeprom is conditionally erased (depending upon EESAVE fuse setting) Memory type flash is always erased Memory type lockbits is always erased ... Erased. Action took 0.01s Thanks for posting this GitHub, it helped me in the right direction.— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you commented.Message ID: @.>

mcpat-it commented 11 months ago

@netkruzer

I ended up figuring it out. The problem on the Raspberry Pi 4B connecting to UPDI, it defaults to having the UART as a console to the OS and connected to bluetooth and that blocks the UPDI from working. Needed to turn the console off via UART, turn on UART (both from raspi-config) and then turn off bluetooth (disable-bt in /boot/config.txt). Then it works flashing a Attiny404 from Arduino-cli.

The wiring you have works, but I ended up just using a 1k resistor and that worked too.

These steps are more for my use, but maybe someone else might find it useful, and definitely for when I forget what I did in a few months:

At the end of /boot/config.txt

enable_uart=1
# Disable Bluetooth
dtoverlay=disable-bt

/boot/cmdline.txt

console=tty1 root=PARTUUID=18ff64a8-02 rootfstype=ext4 fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles

This was a great tip, but I was able to use bluetooth and the /dev/ttyAMA0. I was using the overlay miniuart-bt. See this instructions.

so you have to disable

sudo systemctl stop serial-getty@ttyS0.service
sudo systemctl disable serial-getty@ttyS0.service

and remove console=serial0,115200 from cmdline.txt

and add dtoverlay=miniuart-bt to config.txt (don't use pi3-miniuart-bt, it's obselete).

@becky001 Thx for this simple circuit, it was a great help!!! Btw, pyupdi is also obselete, I use now pymcuprog See here

root@rpizerosm:~# pymcuprog ping -t uart -u /dev/ttyAMA0 --clk 56700 -d attiny817
Connecting to SerialUPDI
Pinging device...
Ping response: 1E9320
Done.

Regards Patrick