1

First post on here.

I’ve recently designed a board for a Raspberry Pico to control the TI TDC7200. This IC uses SPI for communication, 8 bits for command and 24 bits for reading some of the data. Unfortunately, I didn’t realise (and made an assumption) that the Pico would be fine companion for this chip, but after studying the C/C++ SDK documentation that it in fact limited to 16bits max on SPI.

I’ve been looking through the source code for SPI on the Pico, and it looks like it could be possible to add a 24bit read function (although I must admit I haven’t done something like that before!), is there a hardware reason why this might not be possible?

Thanks for any help, and apologies if there is an obvious reason as to why this wouldn’t work.

1

You may be worrying needlessly.

In the worst situation you can just bit bang the SPI protocol as the Pico will be the bus master.

However you can just use the Pico in normal 8-bit mode. For a 24-bit transfer just transfer 3 bytes. Depending on mode (CPHA/CPOL) you might have to control chip select in code. I would do that anyhow as a matter of course.

For a quickish test you could use my picod module.

http://abyz.me.uk/picod/index.html

It has a Python shim around the C SDK program running on the Pico.

http://abyz.me.uk/picod/py_picod.html#spi_open

http://abyz.me.uk/picod/py_picod.html#spi_xfer

2
  • Thank you for the response, I didn't consider bit-banging. Sorry if it wasn't clear in my post, the 24 bit is the response from the TDC7200, but I assume I can also use the bit-bang technique for reading.
    – Jack
    Jul 19 at 13:18
  • With SPI you send a bit/receive a bit. To receive 24 bits you have to simultaneously send 24 bits. Typically the first bits sent are a command and the corresponding returned bits are discarded. The subsequent bits sent are dummies and the returned bits are the device response to the command.
    – joan
    Jul 19 at 15:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.