Wednesday, December 28, 2016

Without microseconds, you're just an outsider

As it is, the HAL library comes with a tick at every 1 millisecond, like a "millis" in an Arduino library. It is your application's timer, allowing you to plan timed, non-blocking tasks, like in a real-time operating system. But no microsecond delay function provided :( . And you know, many initialization procedures or protocols of different external peripherals require microsecond delays in data flux.

Of course I started to search for already written code and I came across Domen Jurkovic code on github, but his assembler code didn't compiled on my toolchain (sure it worked on his toolchain). I continued the search and found on the Mapple library an assembler code that compiled ok on my toolchain and resulted in a function that actually works. I tuned the code to work correctly on my 32MHz clock (look in my repository - link on the right panel).

    asm volatile("   mov r0, %[us]          \n\t"
                 "1: subs r0, #5            \n\t"
                 "   bhi 1b                 \n\t"
                 : [us] "r" (us)
                 : "r0");

Sunday, December 25, 2016

In the blink of an ... LED

I strongly desired to enter 32bit arm microcontroller world with Atmels' SAM-D21 (Cortex-M0+) microcontroller, but the Arduino Zero board came very late and expensive... then Atmel was acquired and... And STM32 it was! In form of the Nucleo board which I see it much over Arduino Zero in terms of features, and four times cheaper!

Thursday, December 22, 2016

My first Nucleo board

Nucleo L152RE board is a present for my birthday and also my first Cortex-M3 microcontroller ever. A board which must be programmed from the Linux, as is the only operating system I use. And is what I did and... failed! Why I have to start with a failure every time I go to a different family of microcontrollers?

How many failures? Read bellow: