Closed Turro75 closed 3 years ago
as alternative the DBG_PADOUT can be reset by writing 0 to PINS with a MOV instruction, I don't know if DBG_PADOUT is affected by GPIO status, anyway for testing purpose seems not important.
async function resetStateMachines() {
await cpu.writeUint32(CTRL, 0xf0);
await cpu.writeUint32(SM0_INSTR, pioJMP(PIO_COND_ALWAYS, 0)); // Jump machine 0 to address 0
// Clear FIFOs
await cpu.writeUint32(SM0_SHIFTCTRL, FJOIN_RX);
await cpu.writeUint32(SM0_SHIFTCTRL, 0);
//reset Pins/DBG_PADOUT
await cpu.writeUint32(SM0_INSTR, pioSET(PIO_DEST_X, 0));
await cpu.writeUint32(SM0_INSTR, pioMOV(PIO_DEST_PINS, PIO_OP_NONE, PIO_SRC_X));
}
Thank you Valerio!
I don't know if DBG_PADOUT is affected by GPIO status, anyway for testing purpose seems not important.
The datasheet says: "Read to sample the pad output values PIO is currently driving to the GPIOs.", so as I understand it it's only affected by PIO and not by any external peripherals.
In any case, both methods are fine, I don't have any strong preference for one over the other.
In any case, both methods are fine, I don't have any strong preference for one over the other.
me neither, both work.
a little bit better the reworked test as it's more generic and allows the testing of any combination of SET PINS
while the other way uses instructions to test instructions, but who cares it's a test and now it passes.
Thanks!
the set pins requires the result and-ed to avoid the other pins status