The new Intel Galileo board is the first intel-based Arduino compatible board. I was given one during the Maker Faire Rome and today I spent some time checking the software and how it is programmed using Arduino.
How the Arduino IDE talks to the board
First interesting fact: the board is interfaced with the Arduino IDE through serial ZModem transfer.
Digging into the ../Java/hardware/tools/x86 folder of the Arduino IDE downloaded for the board, you can find the toolchain and an upgrade.sh file. This is the file used by the Arduino IDE to upload sketches, compiled in elf format on the main PC and sent via ZModem to the board.
Serial port access
Another interesting fact is that the USB client connector doesn't give access to the actual tty port of the Linux distribution, but probably listens only for Arduino IDE commands and serial monitor.
The program responsible for this is called clloader
/opt/cln/galileo/clloader --escape --binary --zmodem
In order to have access to the tty one should use the Audio-jack port sitting on the left of the Ethernet port (called ttyS1). I never saw such a cable, but probably I'm not well informed. I would love to know where to get or how to build one.
It would be lovely to access the console using the second USB port!
SSH & Ethernet connectivity
I also checked the Ethernet connectivity. With the stock "mini" Linux flashed on the board, Intel says it has no DHCP. But I discovered that Linux side gets correctly an IP address, and the Ethernet sketches work out of the box.
Running ps tells that udhcp daemon is running.
For accessing the board via SSH you need to install the provided Linux image on a micro sd card, as no ssh daemon is running.
A trick to have a look to what is running is to use the ZModem protocol to execute remote commands, for example:
./lsz -e -v -c "ps" > /dev/cu.usbmodem1411 < /dev/cu.usbmodem1411
Bogomips and buildroot
Using the trick I checked out dmesg, and discovered the Galileo kernel is Linux version 3.8.7-yocto-standard, compiled using the https://www.yoctoproject.org build system and Gcc 4.7.2.
The CPU is rated 798.17 BogoMIPS, not bad!
Using GPIO pins at blazing fast speeds
Finally I just learnt from a forum post, that it is actually possible to run GPIO pins at up to 2.93MHz using extended Arduino APIs, such as fastGpioDigitalWrite and fastGpioDigitalWriteDestructive. In this last case it is responsibility of the programmer to ensure GPIO registers are correct, directly handling latch.
These are the arduino code examples posted by Intel engineers, see full post for details:
Example-1 - outputs 477kHz waveform on IO2:
setup(){
pinMode(2, OUTPUT_FAST);
}
loop()
{
register int x = 0;
while(1){
digitalWrite(2, x);
x =!x;
}
}
Example-2 - outputs 683kHz waveform on IO3:
setup(){
pinMode(3, OUTPUT_FAST);
}
loop()
{
register int x = 0;
while(1){
fastGpioDigitalWrite(GPIO_FAST_IO3, x);
x =!x;
}
}
Example-3 - outputs 2.93MHz waveform on IO3:
uint32_t latchValue;
setup(){
pinMode(3, OUTPUT_FAST);
latchValue = fastGpioDigitalLatch();
}
loop()
{
while(1){
fastGpioDigitalWriteDestructive(latchValue);
latchValue ^= GPIO_FAST_IO3;
}
}
Example-4 - outputs 2.93MHz waveform on both IO2 and IO3:
uint32_t latchValue;
setup(){
pinMode(2, OUPUT_FASTMODE);
pinMode(3, OUPUT_FASTMODE);
latchValue = fastGpioDigitalLatch(); // latch initial state
}
loop()
{
while(1){
fastGpioDigitalWriteDestructive(latchValue);
if(latchValue & GPIO_FAST_IO3){
latchValue |= GPIO_FAST_IO2;
latchValue &= ~ GPIO_FAST_IO3;
}else{
latchValue |= GPIO_FAST_IO3;
latchValue &= GPIO_FAST_IO2;
}
}
}
As a forum user wrote, this is a "totally new beast".
Comments !