Author Topic: USB SAMD21G18 to ATMega328P programmer  (Read 500 times)

0 Members and 1 Guest are viewing this topic.

Offline IvoSTopic starter

  • Frequent Contributor
  • **
  • Posts: 310
  • Country: us
USB SAMD21G18 to ATMega328P programmer
« on: January 01, 2024, 03:21:47 pm »
I have a project using ATMega328P(already written code) and I need to add some kind of USB programmer to it for the future program changes. I am limited by space so I am looking for smallest thing possible. I found this: https://www.seeedstudio.com/Seeeduino-XIAO-Arduino-Microcontroller-SAMD21-Cortex-M0+-p-4426.html. This can be directly soldered to my board. Now, I am dealing with 2 different voltages. ATMega328P is 5V, SAMD21 is 3.3V. My guess is that MISO/MOSI voltage levels will be a problem. Any advice appreciated.
 

Online coromonadalix

  • Super Contributor
  • ***
  • Posts: 5906
  • Country: ca
Re: USB SAMD21G18 to ATMega328P programmer
« Reply #1 on: January 01, 2024, 04:00:25 pm »
why complicate things

https://github.com/UnfinishedStuff/CH340C

simple, not costly, maybe slower,  but low part count ...  it depends if you need to reset the 328p,  you would need to patch one pin with a capacitor ?

https://www.sparkfun.com/products/15096

https://www.ebay.com/itm/201656306805?
https://www.ebay.com/itm/314481216983?
« Last Edit: January 05, 2024, 06:22:46 pm by coromonadalix »
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12865
Re: USB SAMD21G18 to ATMega328P programmer
« Reply #2 on: January 01, 2024, 04:29:20 pm »
That's fine if the ATmega328P has a serial bootloader installed.   If not, you need a USB chip capable of AVR ISP, preferably supported by AVRDUDE (See: option -c list of programmers).   There are a couple of options here - use a FTDI USB UART e.g. FT232R  and some others, or copy Arduino and use an ATmega16U2, which comes with a DFU bootloader that allows you to load different firmware to change its role e.g. make it an Arduino serial bridge or make it an AVRISP MK II programmer, supported by AVRDUDE and Atmel Studio.
https://fedevel.com/blog/how-to-flash-arduino-bootloader-without-a-programmer.

However if you have source for the project, porting it to an ATmega32U4 would make far more sense.  That's the AVR used on the Arduino Leodardo, with native USB device support, so no USB interface IC required.
 

Offline rteodor

  • Regular Contributor
  • *
  • Posts: 122
  • Country: ro
Re: USB SAMD21G18 to ATMega328P programmer
« Reply #3 on: January 01, 2024, 06:43:35 pm »
USBasp could be an option https://fischl.de/usbasp/
It uses an ATMega8/88 with USB protocol implemented in software. There are better solutions but this one could be tolerable in an one off project. And it works well.
You can drop most of the parts in the USBasp schematic, even the crystal.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf