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 …
My earlier blog posts about FreeRTOS on the ATmega4809 (Arduino Nano Every) were for an older version of the FreeRTOS distribution, 10.3.0-9. The instructions for making the patches to the code don’t quite work for the more recent distributions like 10.5, so to use you will need to either install an older version or work …
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 …
The SAMD21 microcontroller in the more recent Arduino board designs had a clock/calendar built-in. It’s one of the operating modes of the Real-Time Counter. There are counter fields fields for seconds, minutes, hours, (optional AM/PM), days, months, and years. However the year field is only 6 bits, allowing for only 64 years starting at a …
I’ve neglected blogging because I really don’t have any progress to show. I’ve been dealing with sketchy and possibly wrong documentation so have been tediously testing out each feature figuring out exactly what is needed and what is not needed to get things to work. The net result should be that the next book (on …
A friend of mine, David Sparks, is using a SAMD based board (a Seeedstudio XIAO) to be a real time clock. You can see his project here: https://github.com/IowaDave/SAMD21-RTC-Clock. The SAMD has a Real Time Counter which can be configured as a Real Time Clock (RTC=RTC!) eliminating the need for a second component. However when run …
The SAMD21 has 7 clock sources. Each clock source can drive one or more of the nine Generic Clock Generators. The generic clock generators have a programmable clock divider, and each of the 37 peripheral clocks can be fed from one of the clock generators. This is a somewhat formidable mess. The Arduino boards that …