SCLK idle

Started by pjc309430 November 29, 2005
Has anyone found the BX24 HW SPI clock not being able to idle high,
even if SetupByte.3 is set in OpenSPI?



--- In basicx@basi..., "pjc309430" <pjc30943@i...> wrote:
> Has anyone found the BX24 HW SPI clock not being able to idle
> high, even if SetupByte.3 is set in OpenSPI?

What you're seeing may be due to the fact that the BX uses SPI to
read user code from Program Memory. It does this with the SPI
control register set to &H50. (In the BX-24P, the SPI2X mode is
used for high speed transfer.)

The SPCR value that you specify in the setupByte parameter to
OpenSPI prevails only during an SPICmd operation. It reverts back
to the value specified above when the BX needs to fetch the next
instruction.

If this causes a problem with your device you may need to resort to
a bit bang interface. Tom Handley has some code on his site for
this purpose:
http://home.comcast.net/~tomhandley/bx-24/bx-24.html

Another possible alternative is to use the same setupByte as the BX
does and then invert the SCK line before routing it to your device.

Don
http://www.zbasic.net


Very true Don. Thanks. I forgot about that, though it says right
there in the datasheet.
I tried a 16-bit modification of Tom's routines and it works fine.
Switched back to HW with an inverter, and again no, which is
surprising: The device (AD7706 ADC) should be able to work fine with
extra clocks (i.e. bx instruction fetching) as long as its CS is
inactive.

Either way, at least now I know the device works. There's something
strange about the bx SPI... > What you're seeing may be due to the fact that the BX uses SPI to
> read user code from Program Memory. It does this with the SPI
> control register set to &H50. (In the BX-24P, the SPI2X mode is
> used for high speed transfer.)


--- In basicx@basi..., "pjc309430" <pjc30943@i...> wrote:
> Switched back to HW with an inverter, and again no, which is
> surprising: The device (AD7706 ADC) should be able to work fine with
> extra clocks (i.e. bx instruction fetching) as long as its CS is
> inactive.

You might try using the "software reset" procedure - sending 32 high
data bits (4 bytes of &Hff) preceding your actual command/data stream.

Don