I've done many attempts to build and execute my own C program on the atmel sama5d4 xplained ultra board.
Thanks to the tutorial on mikrocontroller-software.de, I was able to cross-compile and run my first binary (see post 13: Breakthrough - Run my own C++ Program on the SAMA5D4).
That same mikrocontroller-software.de has also helped me with the next step: blink the led. |
Getting to Blinky
I've stolen the title of this section. Getting a led to blink is the "Hello, world!" of the embedded world.
Usually, this is the first exercise you do right after unboxing.
It took me so long to get here because of several reasons. I knew that the example that I'm trying here was around, but I held off trying it out.
Grease up your German skills once more, and visit Atmel SAM5D4 LED D8 blinken lassen Beispiel [ATMEL SAMA5D4 Xplained Ultra Getting Started] .
File Handle based I/O with Linux
I'm still struggling with the example.
The author uses the file handles that are created in the linux distro to talk with the peripherals. That part I get.
But I don't know yet why there's both a call to set the GIO ("/sys/class/gpio/pioB3/value") and a call to set the brightness as below:
if(true==on) { LinuxFile("/sys/class/leds/d8/brightness", O_WRONLY).Write("1"); std::cout << "Switch LED on"; } else { LinuxFile("/sys/class/leds/d8/brightness", O_WRONLY).Write("0"); std::cout << "Switch LED off"; }
I'll have to do some more reading, learning and and testing to understand that.
I'm a bit in a disadvantage there, because I don't have wired network in my lab. The board is dangling from my router/wifi device in the living room .
Anyway, the program works. In debug mode, it compiles to 101 KB.
In the console, this is how the execution looks like:
The blue led on the board blinks:
Customer Action Photo:
Top Comments