I'm trying to use the MSP430G2231 to send a continuous, unbroken stream of bits via SPI. My strategy is to use the 16-bit shift register, always keep USICNT > 0 and set the 8 bits of USISRL at exactly the right moment before they get shifted into USISRH and then out. My set-up code and first part of my main loop look like this:
SetupUSI bis.b #USIPE6+USIPE5+USIMST+USIOE,&USICTL0
mov.b #USIDIV_0+USISSEL_2, &USICKCTL ; = SMCLK
bic.b #USISWRST, &USICTL0 ; Enable USI
mov.b #0AAh, R4
mov.b #USI16B + 1Fh, R5
Mainloop mov.b R5, &USICNT
mov.b R4, &USISRL
nop
nop
nop
nop
nop
mov.b R4, &USISRL
... long delay here...
No matter what I try though I can't get the timing exactly right. Looking at the waveform on an oscilloscope it looks like the SPI shift counter stalls for a cycle whenever a value is written to USISRL, is that correct? And if so is there a way I can turn it off? Or is there a better way to do what I'm trying to do?
(Edited once to correct spelling mistakes)