Flashing the Arduino Due (SAM3X) Under FreeBSD, TrueOS

This post is solely concerned with the task of flashing a binary on the Arduino Due. While the Arduino software is great, I like having more control over low-level details.

The Arduino Due is a microcontroller board based on the Atmel SAM3X8E ARM Cortex-M3 CPU. For more information please see the official site.

The board itself has two programming ports. One of them is called the “native” port and is connected directly to the Atmel SAM3X chip. This has a few implications; if a program is already running, the USB port might not be in bootloader mode.

Programming Method

Connect the Arduino Due via the native port. Push the **ERASE** button.
The chip will now default to a programming mode.

Using Bossac

You should have bossac installed on your system. Let’s probe the chip.

~% sudo bossac -i
Password:
Device found on cuaU0
Atmel SMART device 0x285e0a60 found
Device : ATSAM3X8
Chip ID : 285e0a60
Version : v1.1 Dec 15 2010 19:25:04
Address : 524288
Pages : 2048
Page Size : 256 bytes
Total Size : 512KB
Planes : 2
Lock Regions : 32
Locked : none
Security : false
Boot Flash : false

The internal flash is 512KB. Let’s try writing a file.

sudo bossac -e -w -b=1 512k_file_input

Read back the chip, comparing the files, it should be the same.

sudo bossac -r 512k_file_output

Run the basic check.

[sinetek@SEATK0] ~% sha256 512k_file_input 512k_file_output
SHA256 (512k_file_input) = 3d338d950950054ec0d83191ce5e00ed067190af67c2a6eb41547a4bcf3ef1e0
SHA256 (512k_file_output) = 3d338d950950054ec0d83191ce5e00ed067190af67c2a6eb41547a4bcf3ef1e0

That is it for today. In the next installment we’ll make a little blinkylight demo, which will be more exciting!

10.13 (17A264c) NVMe Driver: Poking Around

I wanted to see if the updated NVMe kext in 10.13 (build 17A264c) loads under Sierra. Here is the answer.

$ sudo kextutil IONVMeFamily.kext
(kernel) kxld[com.apple.iokit.IONVMeFamily]: The super class vtable ‘__ZTV18IOTimerEventSource’ for vtable ‘__ZTV21AppleNVMeRequestTimer’ is out of date. Make sure your kext has been built against the correct headers.
(kernel) kxld[com.apple.iokit.IONVMeFamily]: The super class vtable ‘__ZTV18IOTimerEventSource’ for vtable ‘__ZTV21AppleNVMeRequestTimer’ is out of date. Make sure your kext has been built against the correct headers.
(kernel) kxld[com.apple.iokit.IONVMeFamily]: The super class vtable ‘__ZTV18IOTimerEventSource’ for vtable ‘__ZTV21AppleNVMeRequestTimer’ is out of date. Make sure your kext has been built against the correct headers.
(kernel) Can’t load kext com.apple.iokit.IONVMeFamily – link failed.
(kernel) Failed to load executable for kext com.apple.iokit.IONVMeFamily.
(kernel) Kext com.apple.iokit.IONVMeFamily failed to load (0xdc008016).
(kernel) Failed to load kext com.apple.iokit.IONVMeFamily (error 0xdc008016).
Failed to load IONVMeFamily.kext – (libkern/kext) link error.
Check library declarations for your kext with kextlibs(8).

macOS Sierra and the Rosewill N150UB Wireless Adapter: Works for Me

My last adapter got damaged during travel, so I bought a new adapter. Enter the Rosewill N150UB.

rosewill_n150ub

In order to get this working on macOS Sierra, download and install the Realtek drivers for the EW7811Un; I had to modify two files to get the Rosewill working.
The procedure is simple, for both RtWlanU.kext and RtWlanU1827.kext, open Info.plist, copy a section for another device, and replace the values as follows.

Vendor:  3034

Device: 65519

Then you can reboot and load the driver with kextutil.

HOW TO: Linux on the Revodrive X2 !!

It seems that currently using Linux on hardware fakeraid-based platforms is not so simple.

In short, once you know of a little bug in the SiI 31xx controller series everything becomes much easier. Over there is a guide which can help you installing OpenSUSE/Fedora/Ubuntu on the Revodrive X2. The idea is you install everything but the bootloader, and then setup grub manually.

Thanks a bunch, CoolZero.

Unbricking the MSI 890FXA-GD70 After BIOS Flashing Failure With an Arduino

Jul 2017: I found the code again, get it here.


August 2011 update: code no longer available online, mail and I’ll send it

Whew.

For some reason, flashing the MSI 890FXA-GD70 with the AFUWIN utility will brick your motherboard. I do know, however, that the “flashrom” utility does support this board just fine. I had no trouble flashing under Linux using “flashrom“.

This motherboard uses a Winbond W25Q16 SPI FLASH memory chip. Fortunately enough it is fairly easy to unsolder and reprogram this chip with the help of an Arduino.

First of all, carefully remove the memory chip.

Wire it up to an Arduino:

  • GND (pin 4) to Arduino’s ground
  • VCC (pin 8 ) to Arduino’s 3.3V output (5V would likely kill the chip)
  • /HOLD (pin 7) to Arduino’s 3.3V output (5V would likely kill the chip)
  • /CS (pin 1) to Arduino pin 10
  • DO (pin 2) to Arduino pin 12
  • /WP (pin 3) to Arduino’s 3.3V output (5V would likely kill the chip)
  • DI (pin 5) to Arduino pin 11
  • Clock (pin 6) to Arduino pin 13
Grab the source code. Open up .pde inside the Arduino IDE and change the first line to “#define WriteROM” if you want to write or comment it out (“//#define WriteROM”) if you want to read the ROM contents. Then on the PC side run the script like this (requires python, pyserial and progressbar modules) :  “python biosrecovery.py readfile infile r” or if you want to write the chip “python biosrecovery.py readfile infile w” where readfile is the output file and infile the file the ROM will be written from. Also, you will need to change the path to your serial port in the biosrecovery.py script, the line in question is,
ser = serial.Serial('/dev/tty.usbserial-11BP0464', 115200)
It should be possible to run this script on Windows, hit up the pySerial documentation if needed.
Good luck!