ftkalcevic
12-09-2009, 07:36 AM
Sorry if this has been discussed elsewhere, but I just can't get this forum's search to work for me.
I'm trying to write an SPI slave implementation in SPIN, but the data I'm receiving isn't anything like what appears on the wire.· This is a stripped down version of my code...
· repeat
··· b := 0
··· repeat until ina[nCS_PIN] == 1
··· repeat until ina[nCS_PIN] == 0
··· repeat 32
····· b <<= 1
····· repeat until ina[SCK_PIN] == 0
····· repeat until ina[SCK_PIN] == 1
····· if ina[MOSI_PIN] == 1
······· b |= 1
··· vt100.PrintHex( b, 8 )
··· vt100.PrintString(string(13))
···
I wait for CS to go low, then read the bits as the clock goes high.·
The SPI is clocked at 125kHz.· Is this too much for SPIN?· Do I need to use PASM (when I get it working I want to up the clock to 1MHz)
Thanks,
Frank
·
I'm trying to write an SPI slave implementation in SPIN, but the data I'm receiving isn't anything like what appears on the wire.· This is a stripped down version of my code...
· repeat
··· b := 0
··· repeat until ina[nCS_PIN] == 1
··· repeat until ina[nCS_PIN] == 0
··· repeat 32
····· b <<= 1
····· repeat until ina[SCK_PIN] == 0
····· repeat until ina[SCK_PIN] == 1
····· if ina[MOSI_PIN] == 1
······· b |= 1
··· vt100.PrintHex( b, 8 )
··· vt100.PrintString(string(13))
···
I wait for CS to go low, then read the bits as the clock goes high.·
The SPI is clocked at 125kHz.· Is this too much for SPIN?· Do I need to use PASM (when I get it working I want to up the clock to 1MHz)
Thanks,
Frank
·