You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Great! The Pico's timing runs off its internal 32k RC oscillator, and unfortunately it's really not that accurate - probably why the difference is reported. I've been hoping to do something about that, but I'm not 100% sure on the best way around it yet.

    The assembler issue is a fun problem with Thumb assembler - instructions are 2 bytes, but often immediate values need to be multiples of 4. You just need to add nop to align the data correctly:

    var test = E.asm("void()",
                     "ldr  r2,gpiob_addr",
                     "movw  r3,#4",
                     "loopStart:",
                     "str  r3,[r2,#0]",
                     "str  r3,[r2,#4]",
                     "bgt  loopStart",
                     "bx  lr",
                     "nop",
                     "gpiob_addr:",
                     ".word  0x40020418"
                     );
    
About

Avatar for Gordon @Gordon started