• Tue 2020.03.17

    Spent yesterday toying with Low Level Access on STM32 using a Pico. All went well, but not all the functionality appears to be available as with the nRF52LL

    So, this morning, after heeding this note:

    ** Real time counter
    You should only set on ch2 as 0 and 1 are used by Espruino/Bluetooth

    I modifed the toggle channel to 4 and the enable channel to 3. Now the setWatch can be added without killing the underlying PPI counter. But, the setWatch never detects a pulse that clearly swings both rails.

    That is, until during code cleanup to post to the forum, I failed to remove a commented out line of code within the setInterval initialization that caused a separate function to execute unintentionally.
    It contains a local scope copy of the toggle command, (and now I see the global scope one also) but isn't really needed. Why it allows PPI and setWatch to play together is still a bit of a mystery, but at least I have a stable, repeatable, reloadable after power up chunk to play with.

    There is also another anomaly, that when specifying 'af_output' using pinMode, that after PPI signal is sent to the external LED, that the mode changes from 'af_output' to just 'output' with no intentional change by me. (maybe this is why this code block now appears to be stable? - but don't we need the special 'af_' prefix as we are using PPI?)

    While I continue to play/learn how all the bits work under the hood, the following still needs review:

    • The flipped buttons in post #5
    • What channel setWatch is using that may conflict with PPI channels
    • The prescaler code that limits the counter frequency post #11
    • Inadvetent pinMode change 'af_output' to just 'output'
    • Review reset(1) to stop underlying PPI post #10
    • Requirement to force a hard counter stop when making a setup change

    When playing with this code file, be aware it takes around five seconds to upload and initialize before commands may be entered.

    1 Attachment


Avatar for Robin @Robin started