Hi there,
I'm trying to use the hardware SPI support in the 20x2 but I can't get it to work.
I've wired up a basic circuit:
- usual download circuit
- pin 13 (HSPI SDI) tied to ground via a 4k7 resistor
- pin 14 (B.4) LED + 220R to ground
with this code:
But it never prints out "Sent" - instead it resets after a couple of seconds. I've read the recent post about hardware SPI on the 28X2 (http://www.picaxeforum.co.uk/showthread.php?t=13179&highlight=hspiout) and I think I understand it, but by my reading of it this circuit should work. I've also tried wiring the 20x2 up to an AVR ATMega8 programed to be an SPI slave with no joy but I can't be 100% sure I got the AVR program right. The 20x2 has firmware C.0.
Can anyone spot what I am doing wrong and is anyone else using hardware SPI on the 20x2?
Thanks in advance!
David
I'm trying to use the hardware SPI support in the 20x2 but I can't get it to work.
I've wired up a basic circuit:
- usual download circuit
- pin 13 (HSPI SDI) tied to ground via a 4k7 resistor
- pin 14 (B.4) LED + 220R to ground
with this code:
Code:
symbol LED = B.4
setfreq m8
sertxd ("Starting",cr,lf)
; Flash the LED to indicate reset
high LED
pause 500
low LED
hspisetup spimode00, spislow
main:
sertxd ("Sending",cr,lf)
hspiout (1)
sertxd ("Sent")
pause 2000
goto main
Can anyone spot what I am doing wrong and is anyone else using hardware SPI on the 20x2?
Thanks in advance!
David