Arduino has long used Atmel (now Microchip) 8-bit AVR architecture microcontrollers. The ATmega328P, ATmega32U4, and ATmega2560 have been discussed here. Arduino no longer is “in bed” with Microchip, but there are two other Microchip microcontrollers used in Arduino boards, the ATmega4809 and the SAMD21. Both of these are favorites of mine. ATmega4809 The ATmega4809 is …
I thought it would be interesting to compare the speeds of various Arduino boards, from older designs to the newest microcontrollers. I looked at the following: Note that the Nano 33 IoT, the Nano RP2040, and the Uno R4 (WiFi version) all have an ESP32 as a coprocessor for the radio functionality. The Nano ESP32 …
The DAC (analogWrite to A0 in Arduino Nano 33 IoT, MKR, and Zero boards) isn’t specified to work to the extreme limits. Basically it doesn’t go below 50mV or above 3.25 volts. While the Arduino documentation doesn’t mention this, the datasheet does in section 37.11.5. While the DAC is 10 bits, the analogWrite function reduces …
The Analog to Digital Converter in the SAMD21 is specified to run with a clock frequency from 30 to 2,100 kHz. The Arduino Library configures the ADC clock to be the 48 MHz system clock divided by 256, or 187.5 kHz, or a clock period of 5.33 µs. The conversion time is 7 clock periods, …
The SAMD21 based Arduino boards have a 10 bit DAC, so naturally I wanted to generate a sine wave! Some years ago when I was teaching microcontrollers I had students build a DAC using a resistor ladder. The microcontroller, a 68HCS12, used a timer interrupt to advance the value to the DAC by indexing a …
The Seeedstudio XIAO SAMD21 is a small board with 14 pins that is highly compatible with Arduino’s SAMD21 based microcontroller boards (Nano 33 IoT, Zero, and the MKR series of boards). It contains only the microcontroller, a crystal oscillator (which the Nano 33 IoT does not have), voltage regulator and a “modern” USB-C connector for …
The ARM-based (SAMD21) Arduino Nano 33 IoT might have been rushed into production based on a somewhat deficient assignment of Timer/Counters to PWM pin functions. Arduino documentation claims 11 PWM pins: D2, D3, D5, D6, D9, D10, D11, D12, A2, A3, and A5. However the following is not documented: This means there are only really …
Today I’m going to revisit the Real Time Counter (RTC) in the SAMD21 microcontroller. When running in real time clock mode (mode 2) a single register holds the date/time value with separate bit fields for year, month, day, hour, and seconds. The value can be printed out with this code: But there are some issues …
With the AVR-based Arduino boards, doing an input capture in a timer/counter (to time stamp a signal edge) was very simple, although not supported in the Arduino library. It’s just three instructions to completely configure. With the SAMD21 it becomes a major programming effort to get an external signal to the timer/counter. So 14 instructions. …
The Arduino documentation states that the maximum resolution of the PWM analogWrite (not the DAC analogWrite) is 12 bits. However the SAMD21 has 16-bit timer/counters and the actual resolution is 16 bits. So you can call analogWriteResolution(16) successfully. Because of the high resolution, the PWM frequency is a fairly low 732Hz, being 48MHz/65536. If the …