New in Microcontrollers, need help with bootloader.

Thread Starter

PabloTF12

Joined Oct 11, 2020
4
Good Afternoon guys.

I am Pablo and I have just started my PCB design journey and I think I need some help. I am trying to design my own Arduino using an ATSMAD12G18 microcontroller, but I do not know how I could make it work with the Arduino IDE. I have done some research and came across with the bootloader term and how to install it to a microcontroller: https://www.allaboutcircuits.com/pr...pproximating-functionality-of-an-Arduino-UNO/
So my question is if that process is the same for all Atmel microcontrollers

Kind Regards

Pablo
 

MrChips

Joined Oct 2, 2009
30,707
What is Ardunio?

The Ardunio is a platform based on Atmel AVR microcontrollers, most commonly, ATmega328. In order to run any MCU you need machine code in the computer's flash memory.

ATSAMDxx MCUs are ARM based chips, made by Microchip. (Atmel was acquired by Microchip in 2016.) Machine code in an ARM MCU is not the same as machine code on Atmel AVR MCU. The two are not compatible.
 

Thread Starter

PabloTF12

Joined Oct 11, 2020
4
A good starting point is take for reference one of existing Arduino board schematic like Arduino Zero or Arduino M0. For burning the bootloader program you need a Atmel ICE programmer or another Arduino board, see for Documentation tab here.
Hi Trebla.

I have looked at the Adafruit Feather M0 Adalogger schematic as it has LiPo battery support and SD card holder, I would like to replicate that in a custom pcb, adding some sensors (Accelerometer, gyroscope...). So I would need an Atmel ICE device to upload the arduino uno bootloader and then I could use arduino IDE to develop my code and upload it using the USB port?

Thanks
 

Thread Starter

PabloTF12

Joined Oct 11, 2020
4
Bootloader is needed if you want program Arduino boards via USB ports. Without the bootloader you must always use some programmer device.
Hello Again.

So I could use ATME ICE to upload the arduino Zero or M0 bootloader and then use the USB port to upload the codes using the Arduino IDE, or use ATMEL studio to do the same without the bootloader step right?

Sorry but is quite confusing for me, I have barely done nothing with microcontrollers during my Mechanical engineering MEng

Again, Kind Regards
 

trebla

Joined Jun 29, 2019
542
If you do not use Arduino libraries then you must do all neccesary clocking and fuses setup for MCU, but you can use any suitable IDE with Atmel SAM support (for example Visual Studio). If you use Arduino libraries then you can use either bootloader or Atmel ICE (or JTAG ICE) programmer with Arduino IDE. Make sure you have installed needed board packages under Arduino IDE. Then you can see available programmers under Tools->Programmers menu. With Arduino IDE you can burn the bootloader too.
 

Thread Starter

PabloTF12

Joined Oct 11, 2020
4
you have installed needed board packages under Arduino IDE.
If you do not use Arduino libraries then you must do all neccesary clocking and fuses setup for MCU, but you can use any suitable IDE with Atmel SAM support (for example Visual Studio). If you use Arduino libraries then you can use either bootloader or Atmel ICE (or JTAG ICE) programmer with Arduino IDE. Make sure you have installed needed board packages under Arduino IDE. Then you can see available programmers under Tools->Programmers menu. With Arduino IDE you can burn the bootloader too.
By libraries, you mean the Arduino SAMD Boards library right? only this one or that and the Adafruit SAMD boards library?
Once I have downloaded and installed the libraries I could just plug-in the device with the USB and burn the bootloader right?

Thanks
 

trebla

Joined Jun 29, 2019
542
First you must look at Tools menu, is the Arduino M0 (or Zero - depends which type board you have) board installed in yor Arduino IDE. If it is not, install M0 (Zero)packages with Library manager. Then you can select M0 (Zero) board and Atmel ICE (or for Zero variant Atmel EDBG) programmer under Tools menu and write bootloader to the MCU. After that you can program your custom board via USB port like all Arduino boards. As Atmel ICE programmers do not provide power to the MCU, you must feed power from another power source, better use battery power to be surely isolate computer USB port from AC lines. There is a discussion about same issue.

I mean big collection of libraries which are written for Arduino Wiring library. For each supported MCU type for Arduino exist Wiring library port, i think you can find it under Hardware directory. You can rewrite those for use without Arduino Wiring if you want. Arduino libraries make fast prototyping easy but sometimes provided libraries have some hidden HW/SW confilicts when used together. For final product i never use Arduino because i dont know Arduino libraries quality and instead digging in these libraries is much easier to write my own. I don't want to say that Arduino ecosystem is bad, opposite- it is very useful thing but i think that every application has its own requirements and some fits to Arduino and some not.
 
Top