Categories
Arduino Embedded Hardware

Arduino* and a custom board

At work a colleague developed a custom board in the time of chip shortage™ and had to use a 20 MHz oscillator in place of a 16 MHz requiring a custom board configuration. The solution after searching the often misleading Arduino forums was to hack it into the global platform.txt.

This is neither portable nor does it interact well with updates of the Core. Fortunately, there are very good, not misleading forum posts!

A (hopefully more than just slightly) better solution is to use the hardware/ directory in the Sketchbook folder and to reference the standard Arduino configurations (using the VENDOR_ID:VARIANT_ID notation).

  • Let’s name the board gsino since my colleague and I work at GSI.
  • Then let’s create a folder structure $SKETCHBOOK/hardware/gsi/avr and …
  • … write a basic boards.txt shown below:
gsino.name=GSino Board

gsino.upload.tool=arduino:avrdude
gsino.upload.protocol=arduino:arduino
gsino.upload.maximum_size=32256
gsino.upload.maximum_data_size=2048
gsino.upload.speed=144000

gsino.bootloader.tool=arduino:avrdude

gsino.build.mcu=atmega328p
gsino.build.f_cpu=20000000L
gsino.build.board=AVR_UNO
gsino.build.core=arduino:arduino
gsino.build.variant=arduino:standard

If the created folder contains only this board.txt file, the menu entry in the IDE for this board will be “Tools/Board/gsi-avr/GSino Board”. If you want it a little prettier, create a platform.txt with

gsino.name=GSino
gsino.version=1.0.0

Voilà! If you need to take this to another computer or share it with a friend, just zip the relevant parts of the $SKETCHBOOK/hardware/ folder and unpack it in its new location.

Screenshot of the archive showing the folder hierarchy: "hardware/gsi/avr/" with the three relevant files "boards.txt", "platform.txt" and "programmers.txt".

And there you have a slightly more portable and cleaner solution to writing your own hardware platform.

*) This was done on Arduino IDE version 1.8.19 and should work for quite a while (probably after version 1.5.x). AFAIK, this should work similarly with the new 2.0 IDE. But I did not test this.

Categories
Hardware Linux

SATA/Soft-RAID Cards that work

A while ago, I wanted to add more space to my MD+LVM2 array on a Linux machine (Ubuntu 20.04 at the moment).
The setup used MD to make a RAID1 of two HDDs and knowing that I would eventually like to add more storage later, I put LVM2 on top.

A Card That Doesn’t Work

The moment came but I realised my mainboard did not have enough SATA ports. So, after some research, I bought a HighPoint Rocket 640L PICe SATA host adapter which comes with a Marvell 88SE92xx series chip (88SE9230 in my case).

Tl;dr: Don’t.

It took me half a day of research to figure out that (as of September 2021 and Linux kernel 5.4, but I tried 5.14 too) it would not show disks at all if IOMMU was activated. Also, it did not like stand-by/hibernation: HDD 4 would spin up fine on boot, but would not show up after a stand-by rendering the RAID incomplete, and the LVM volume in read-only mode. Which is a nice safeguard, thanks LVM-developers! But still annoying as such of course.

A Card That Does Work

So, I did more research and found the Delock 5x SATA PCIe x4 Card featuring a JMicron Technology chip (with an ID [197b:0585]). And guess what:

  • All disks come back after stand-by/hibernation
  • IOMMU and virtualisation can be switched on, no problem
  • It even has one more port than the HighPoint card

Disclaimer: All this may change in the future. I have no idea if this is a driver problem or a problem with the chip. But I though it might save some of you time.

Conclusion

Don’t use Marvell 88SE92xx series, at least in a Linux system. Full stop.