On Thursday and Friday, I spend some times coding the threads of the test PCB. I first debug and check if everything was ok for our thread that will read the state of all the box via the hall effect sensor. I used a logic analyser to check if everything was fine. I checked that the four pins that will be used for the multiplexer will not change until the end of the sending of an I2C message. Then I code a thread that initializes all the H-bridge by putting them at the 0 state.
I also realize that I have not seen a mistake in our scheme.… Read more
Executing our code from flash
Last week Sibille and I moved our bare-metal code for the processor-PCB (which so far was directly inserted in RAM by the GDB debugger) into the Flash memory proper, and wrote code that will execute from Flash to copy everything in RAM and continue execution from there.
However, we soon noticed a strange bug: the GDB debugger now ignored every breakpoint we tried to set in RAM (breakpoints to parts of the code executed in Flash before the copy to RAM still worked fine). After a lengthy debug session, Alexis determine that it‘s a bug from the GDB debugger and not from our code.… Read more
Here’s a riddle:
A for loop with index
i and stop condition
i < x contains a code which prints
i and does some non relevant computations. When
x is greater than
y the code prints
i up to
x-1 (as you would expect), but when
x is smaller than
y the code prints i up to 51. The threshold
y is slightly random (it hovers around
1120), but the
51 is not. What is happening ?
Well, first here’s more precise information on what actually happens: if
x > y the code actually doesn’t print all the values up to
y-1, it only prints the first 51 values and the values between
x-1 .… Read more
Today Sibille and I made great strides on the bare-metal code for the led-driving processors.
Yesterday we left off unable to see the PWM outputs on the processor pins. Today we started by remedying an oversight: we set about configuring the clocks.
On top of that, it turns out that yesterday we didn’t pay enough attention when reading the documentation for the board: the documentation includes pinout information for other boards with other processors, and we were looking at the wrong processor…
We were then able to use a Saleae Logic analyser to observe the PWM output. At first, the frequency was off, and we spent much time looking at our clock configuration before realising that the timer prescaler didn’t behave in the way we expected (it turns out that frequency division ration if the prescaler value plus one, which is a neat way of avoiding a “division by zero” type of situation). … Read more