Shop OBEX P1 Docs P2 Docs Learn Events
SPI_Asm bug — Parallax Forums

SPI_Asm bug

My code works with SPI_Spin but not SPI_Asm…

I'm interfacing a Prop with EVE2 based display module.
It's regular SPI, but with 32 bit packet size.


I found the bug (I'm going to call this a bug) in the assembly code, in the MSBFirst_ section:
shl     t5,             arg3              ''          Shift "1" N number of bits to the left.


LSB first works, but MSB first does not for bits=32

This messed me up pretty good, had to break out oscilloscope to figure out what is going on...

Comments

  • RaymanRayman Posts: 14,646
    This version may have bug fixed.
    Seems to work for me anyway...
  • Hmm, I can't confirm that particular case as I don't have one, but the change breaks an ssd1331 object for me, vs the original SPI_Asm object, or the spin-standard-library rewrite of it (com.spi.spin), though the 1331 doesn't need the 32bit transaction capability. Maybe this would just be more of an EVE2-specific SPI driver...or maybe there's a way to get it to work with other devices and I'm just not experienced enough ;)
  • RaymanRayman Posts: 14,646
    Yeah, my driver doesn't work for me anymore either...
    Maybe only 32-bit transfers work...
    I think I'll just make a new one that does only what I need...
  • RaymanRayman Posts: 14,646
    kuroneko gave me some code to fix this, see attached, seems to work now.
  • Confirmed here too...thanks Ray and kuroneko!
Sign In or Register to comment.