

I probably won't have more time for this soon, though. I guess this either needs some debug prints (to read back various register values) or a JTAG debugger to verify what parts are correct and where the problem starts (or looking at the asm more closely and really verifying that all the values are correct). # I suspect this is the RAMPZ register, which contains the upper bits for a # This function continues with more case handlers

connect pwm to pin on timer 0, channel A # The jump table ends here, and this is the first case handler # This jumps to 0x01af (word address, so byte address 0x35e) which seems sane # This is the jump table, the first entry for digitalPinToTimer(pin) = 1 # the table actually starts at 0x338 + 2). # starts at 0x338 and each entry is 2 bytes (note that a timer 0 is invalid, so # at 0x338 + 2*digitalPinToTimer(pin), which makes sense since the jump table tablejump2 below then doubles this value, so it ends up looking # around to add 0x19c, which is half of 0x338 which is where the jump table # (r30), extends it to r30:r31:r24 (little-endian, and adds 0x19c (by It takes the value returned by digitalPinToTimer(pin) # This checks for NOT_A_TIMER or similar, and jumps to 0x48c which handles that case

# This loads the timer value from a progmem table (item inside the table is at 0x01A7) # Note that the pin number is constant propagated, only the val is passed in r24
