I was intending to start work on the next installment of the PEX tutorials which was supposed to be about PWM output (since the Pokitto doesn’t have true analogue output), but I’ve hit a snag.
It seems that the construction of an mbed::PwmOut
object causes the Pokitto to lock up. I don’t know if it’s getting stuck in a loop or if the CPU is crashing somehow.
I’ve confirmed that it’s the construction of the PwmOut
object that causes it.
I tried making the object global, which causes the Pokitto to lock up the moment it’s switched on.
I also tried making the object local by creating it after pokitto.begin()
and that allows the Pokitto to go up to the headphone configuration screen and lock up after confirming a headphone volume. Notably the headphone screen stays displayed, implying that the screen is still drawing but the buffer isn’t being cleared.
When I say ‘lock up’, I mean only the main process freezes at the point of construction.
Interrupts still work so it’s still possible to put the Pokitto into CRP DISABLD mode and upload a new program.
I’m not sure if this is a fault with the PwmOut
class or a conflict between PwmOut
and the Pokitto library, but I would assume that PwmOut
normally works on all mbed boards and that a code conflict is more likely.
(Despite not being sure I’ve categorised this under ‘bug reports’ because it’s a bug with something in the software chain, whether it’s the Pokitto side or the mbed side.)
Sample of global creation:
#include "Pokitto.h"
// The pokitto core library
Pokitto::Core pokitto;
// Create a 'PwmOut' object to represent the
// pwm output pin used to output a signal to the LED
// The object is set to use the EXT0 pin for output
PwmOut led = PwmOut(EXT0);
// The main function
int main()
{
// Initialise the Pokitto
pokitto.begin();
// The main loop
while (pokitto.isRunning())
{
// Update the Pokitto's state
if (pokitto.update())
{
}
}
return 0;
}
Sample of local creation:
#include "Pokitto.h"
// The pokitto core library
Pokitto::Core pokitto;
// The main function
int main()
{
// Initialise the Pokitto
pokitto.begin();
// Create a 'PwmOut' object to represent the
// pwm output pin used to output a signal to the LED
// The object is set to use the EXT0 pin for output
PwmOut led = PwmOut(EXT0);
// The main loop
while (pokitto.isRunning())
{
// Update the Pokitto's state
if (pokitto.update())
{
}
}
return 0;
}