Friday, October 10, 2014

Mainline Linux for RIoTBoard

Yep, these days you can enjoy a good Linux mainline support for RIoTBoard, thanks to the hard work of lots of people. Here are my notes how to build latest Linux kernel for this cool board.

mkdir ~/riotboard
tar xf linux-3.17.tar.xz && cd linux-3.17
make distclean && make imx_v6_v7_defconfig && make LOADADDR=0x10008000 uImage -j4
cp arch/arm/boot/uImage ~/riotboard/
cp arch/arm/boot/dts/imx6dl-riotboard.dtb ~/riotboard/
make modules_install INSTALL_MOD_PATH=~/riotboard

Well, now ~/riotboard contains the fresh kernel, device tree and drivers, so you can copy them to your embedded target.

Mainline U-Boot for RIoTBoard

Well, the days when there was no mainline U-Boot support for RIoTBoard are behind us. The official board support was added with v2014.07. Here are my notes for how to get the latest bootloader for your RIoTBoard, just make sure you have a working ARM cross-compiler.

tar xf u-boot-2014.10.tar.bz2 && cd u-boot-2014.10
make distclean && make riotboard_defconfig && make u-boot.imx -j4

You can load u-boot.imx on the board either via USB OTG port (by using Freescale's MFGTool or Boundary Devices's imx_usb_boot), just configure the on-board micro-switches for USB OTG boot, as described here.

Otherwise you can flash the new bootloader to your non-volatile boot memory (spi nor, sdcard, raw/managed nand, etc). I prefer to test new bootloaders via USB.

Monday, October 6, 2014

Introduction to RIoTboard

I have this board for some months, finally decided to put some technical notes about the RIoTboard's peripherals and interfaces.

Main components:
- CPU: i.MX6 Solo @ 800 MHz, 512K L2 cache, 32K+32K I&D cache
- RAM: 1 GiB DDR3 @ 400 MHz (800 MT/s), 32-bit, single rank

- USDHC2: SD card (J6)
- USDHC3: MicroSD card (J7)

- UART1: Connected to OpenSDA debugger
- UART2: 3.3V serial console (J18)
- UART3: Expansion port (J13)
- UART4: Expansion port (J13)
- UART5: Expansion port (J13)
- I2C1: PMIC, audio codec
- I2C3: LVDS DDC, Expansion port (J13)
- I2C4: CSI, Parallel camera, Expansion port (J13)
- SPI1: Connected to OpenSDA debugger
- SPI2: Expansion port (J13)
- SPI3: Expansion port (J13)
- USB 2.0 OTG: OTG port (J11), the board can boot from this interface
- USB 2.0 Host: uses internal USB-hub to provide 4x host ports with over-current protection
- Ethernet: 10/100/1000 Gigabit ethernet (PHY address 0x04)
- Audio: I2S integrated audio codec with MIC preamp and HP amp, supports sample-rates 8-96 KHz, supports master-slave clocking, full-duplex mode. Beware that the SGTL5000 doesn't respond at all to I2C communication if the master clock is not running.
- HDMI: HDMI connector (J3) - the only port that has ESD-protection
- LVDS0: LVDS connector (J2)
- CSI: MIPI serial camera (J8)
- Parallel camera: Not sure whether this is MIPI-compliant (J9)
- JTAG: Debug interface with non-standard connector (J10), you can easily wire standard 20-pin ARM JTAG connector here

Boot sources:
They are selected by 8-way micro-switch SW1. Here's a list of some common boot configurations:

[00 xxxxxx] - Boot from fuses (Note: fuses are not programmed by default!)
[01 xxxxxx] - Boot from OTG (can be used with MFGtool for Windows or imx_boot for Linux)
[10 xxxxxx] - Internal boot (boots according to BOOT_CFG pins)
[11 xxxxxx] - Reserved

Here are all usable combinations (imho) for the Internal Boot:
[10 10X010] - MicroSD card (J7), normal boot, 1 delay cells, 1-bit, port = USDHC3
[10 10X110] - MicroSD card (J7), normal boot, 1 delay cells, 4-bit, port = USDHC3
[10 10X001] - SD card (J6), normal boot, 1 delay cells, 1-bit, port = USDHC2
[10 10X101] - SD card (J6), normal boot, 1 delay cells, 4-bit, port = USDHC2
[10 110011] - eMMC NAND, normal boot, 1-bit SDR, port = USDHC4
[10 110111] - eMMC NAND, normal boot, 4-bit SDR, port = USDHC4

Orient the PCB so that the imx6 is at the top side, and SW1 is bottom side. 0 means low switch position, 1 means high switch position.

The board has a pretty modern and fast Cortex-A9 CPU (if you have used Cortex-A8 boards in the past, you'll feel the difference instantly), and also the CPU is probably the single best documented modern ARM Cortex-A9 in the commercial world. The board has also good amount of system memory, flexible on-board audio, lots of connectivity and display options, low power consumption. All this can be yours for a price which is definitely in range of home experimenters (it currently retails for 70.49E at Farnell, which is about 89$ USD). Btw, the board was designed and manufactured by Embest Technologies, and I think they've done a great job with this design. As of today, Embest is acquired by Farnell.

All interfaces (except HDMI) are missing ESD protection (TVS diodes are not soldered, even if they're shown on the schematic). Taking into account that this board is intended to be attached to zillions of user devices, peripherals and what-not, for me this is a serious failure. Congratulations, you-re just about to fry 70 euro.

Sunday, October 5, 2014

TDA1543 from China

Recently got a bunch of TDA1543's from China-based seller. I was wondering about how good these chips are, taking into account that they are not manufactured anymore, and there's a huge change to receive either completely borked chips, or chips discarded by factory testing.

So, as I usually do for all my new ICs, I set up a testbench and checked what's up with these. I was kinda pleasantly surprised to find out that they actually work. Still puzzled, I decided to check all possible sample rates that my USB sound card allows (I'm using for the test Asus Xonar U7). It turned out that chips handled without issues samplerates in the range 44.1-96 KHz, but on 176.4 KHz instead of music I heard horrifying noise. I explicitly check one old original TDA1543 made by Phillips, and handled 176.4 KHz without any issues, exactly following the specification. Of course, the original Philips TDA1543 also couldn't play at 192 KHz.

Intrigued by this finding, I tested all new chips from the batch (10x total) and found that:
- 6 of them work up to 96 KHz
- 3 of them work up to 176.4 KHz
- 1 of them is sleeping with the fishes

Well, that's not too bad. The intended usage for these DACs is for retro computing projects using samplerates below 96 KHz, and the can easily tolerate non-audiophile performance, so no big deal.

So, this was my opinion on "TDA1543 from China". Hope this helps someone.