Skip to content

Example pwm.pio re-implementation not working #21

Closed
@zeroflow

Description

@zeroflow

I've had my try at replicating the pwm.pio example from the raspberry pi GitHub.

The C-Code ported to CircuitPython does not work, and generates different pio assembly code than if rewritten in MicroPyton.

Pwm_Example_MP_CP.zip

One notable difference is in the generated pio binary code:

CP: [32896, 40999, 41030, 165, 4102, 41026, 131]
MP: [36992, 40999, 41030, 165, 6150, 41026, 131]

Looking at a disassembled version of these numbers, it can be seen, that the sideset arguments are different between both versions.

CircuitPython
PUSH    noblock 00000 <----------
MOV     X OSR   00000
MOV     Y ISR   00000
JMP     X!=Y 5  00000
JMP      6      10000 <----------
MOV     Y Y     00000
JMP     Y-- 3   00000

Micropython
PUSH    noblock 10000 <----------
MOV     X OSR   00000
MOV     Y ISR   00000
JMP     X!=Y 5  00000
JMP      6      11000 <----------
MOV     Y Y     00000
JMP     Y-- 3   00000

That's just one example, I've also had troubles getting other pio code to run, but this was the most understandable for debugging.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions