wokwi / rp2040js

A Raspberry Pi Pico Emulator in JavaScript
MIT License
384 stars 40 forks source link

Support SPI DMA #131

Closed guysv closed 11 months ago

guysv commented 11 months ago

potentially closes #98, see comment there.

must admit this looks even slower than straight spi register to callback path... we probably want to squeeze the CPU better here.

urish commented 11 months ago

Thanks! Looks like there are some missing calls:

  1. in doTX, after pulling an item from the txFIFO, I think we should call updateDMATx
  2. in completeTransmit, after pushing an into to the rxFIFO, I think we should call updateDMARx

Also, please format the code with prettier (it should happen automatically when you commit, not sure why it was not working for you)

guysv commented 11 months ago

i just moved the calls to updatefifos seems related to there.

guysv commented 11 months ago

I think something broke, DMA SPI works fine but direct SPI writes x4 the data, ie every spi.write is translated into 4 register writes. very weird.

urish commented 11 months ago

Sounds weird indeed, how did you observe that behavior?

guysv commented 11 months ago

I added a micropython test that checks the spi call. should be ok. don't know what happened to what i found in the earlier message 🤣

urish commented 11 months ago

Thank you!

urish commented 11 months ago

Looks like the SPI test is failing with older releases of MicroPython (e.g. 1.19.1: https://github.com/wokwi/rp2040js/actions/runs/6247824728/job/17028285253?pr=131)

Mind looking into that?

guysv commented 11 months ago

looks like I forgot to pass the expected SPI messages as parameters to the CI npm test invocation. please try again.