Xiao hard chip to use

I have decided to abandon the use of the Seeeduino Xiao in a fire detection project I'm doing. It very frequently loses contact with the serial port. And not having a convenient reset button makes that a real pain. The other odd thing I have experienced in drifting behavior of the ADC. I am reading a thermistor, using the Steinhart-Hart equation to convert that to temperature. When I leave the thermistor in a very stable environment, say +/- 1 deg., it will truck along nicely for awhile, then move five to ten degrees in either direction. I've measured the voltage, which does not reflect this variation. Another problem with the chip is the exceedingly low drive capability, less than 3 ma. source or sink. Even lighting an LED takes a transistor. And of course, it has no EEPROM, so any nonvolatile parameters you wish to store are gone with every upload of new code. It's back to the old saw: you get what you pay for.

Hi jrdoner,

The Seeeduino Xiao is simply a SAMD21G18A microcontroller housed on a tiny board. This is based on the original Arduino Zero.

There have been problems with the accuracy of the SAMD21 ADC meaurements, due to the way in which analogRead() takes a measurement: Your Arduino SAMD21 ADC Is Lying To You | Hackaday.

However, this issue can be worked around using register manipluation. I can provide examples if required?

Another point is that the internal 3.3V analog reference is taken from the 3.3V analog supply. Any fluctuation or noise on the supply will affect the analog reading. The 1.0V analog reference by contrast is taken from the microcontroller's stable 1.0V bandgap voltage reference. It does mean though, that you have to constrain you analog input voltage range to between 0.0V and 1.0V.

Regarding the SAMD21's pin drive capability, by default it can sink or source up to 3mA. However, it's possible increase a given pin's driver strength to source 7mA and sink up to 10mA, by setting its DRVSTR bit. For example to set the DRVSTR bit for digital pin D7:

PORT->Group[g_APinDescription[7].ulPort].PINCFG[g_APinDescription[7].ulPin].bit.DRVSTR = 1;

Although the board itself has no EEPROM, it's possible to either attach an external I2C/SPI EEPROM IC such as the Microchip 24LC256 (I2C)/25LC256 (SPI) or alternatively use cmaglie's EEPROM emulation library. The library utilises the microcontroller's on-chip flash as a substitute for the lack of on-chip EEPROM:GitHub - cmaglie/FlashStorage: A convenient way to store data into Flash memory on the ATSAMD21 and ATSAMD51 processor family.

Note that while the external EERPOM devices have an endurance of around 1,000,000 write cycles, the microcotnroller's flash memory can only withstand around about 10,000 writes.

MartinL:
However, it's possible increase a given pin's driver strength to source 7mA and sink up to 10mA, by setting its DRVSTR bit.

Why do you think the chip would have such a feature? Why not simply give all i/o pins that capacity full time? There must be some downside to enabling that setting, to justify the extra complexity.

Hi PaulRB,

Why do you think the chip would have such a feature?

I imagine it's because each of the SAMD21's VDD/GND pins are connected to different GPIO clusters. Each GPIO cluster only capable of sourcing up to 46mA and sinking 65mA max.

Imposing a default 3mA default pin current, allows the GPIO pins to be used without relatively freely without inadvertently exceeding the GPIO cluster current.

Incorporating driver strength bit, is essentially getting the programmer to explicitly state that they're connecting the pin to drive a higher current.

I appreciate that this doesn't make much sense from an electrical perspective, since as you mention, they could have just allowed all the pins to be driven to their maximum current by default. I guess this feature is attempting to prevent the little SAMD21 chip from being fried to death.

Thanks Martin, reasonable theory. So does that mean the pin currents are proactively limited to 3mA? If not, what's the point?

I suspected that perhaps the analog reference voltages were being derived just from the power supply. I have gone back to the humble nano for this project, and I can use an external precision voltage reference (TL431) for ARef. In retrospect, I eliminated enough transistors (for driving peripherals), that the overall real estate required is the same. I might want to use this if both speed and size were highly critical, but again, when you have to kit it out with external parts to take care of its shortcomings, is it worth it?

So does that mean the pin currents are proactively limited to 3mA? If not, what's the point?

The SAMD21 datasheet barely mentions what setting the driver strength bit does, other than a table in the electrical specification section.

Left to speculate, I reckon it just engages an additional push-pull driver circuitry. I imagine it would be too costly to implement any form of proactive current limiting.

I have gone back to the humble nano for this project...

I still use AVR microcontrollers as well. Sometimes they're just a better fit for some projects than ARM based microcontrollers with all their additional complexity.

After hooking up a nano to do the same job that I was using the Xiao for, and getting highly stable readings using an external analog reference, I think I can safely say that the internal ARef's in the Xiao are not all derived from precision references. Maybe one of them is, but beware the ADC capabilities of that processor.

I do use it because of its small size
But only to port over an already developed program - and for the same reasons you sight.
I build and debug the program with a Nano.
And then port it over to the seeduino.

However it doesn’t appear to have compatibility with the Sofware Serial Library.
And currently I don’t know of another library that performs the same function with it.

I posted a question about that on the Seeeduino forum - and got zero responses.

Hi got_arduino,

The reason that SAMD21 boards such as the Xiao don’t have a software serial library, is because it’s possible to use one (or more) of the microcontroller’s spare serial communication (SERCOM) modules, to create additional hardware serial, I2C or SPI ports.

Adafruit have an excellent tutorial here: Overview | Using ATSAMD21 SERCOM for more SPI, I2C and Serial ports | Adafruit Learning System.

It’s not a drop in replacement for the software serial library, but does allow additional serial ports to be created.

MartinL:
Hi got_arduino,

The reason that SAMD21 boards such as the Xiao don’t have a software serial library, is because it’s possible to use one (or more) of the microcontroller’s spare serial communication (SERCOM) modules, to create additional hardware serial, I2C or SPI ports.

AH!
Thank you very much! :-]

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.