2

I'm just learning about Pico Programmable IO (PIO). The examples I see cover only single pin communication. I'm wondering whether PIO can handle multi-pin communication (like I2C having one pin each for clock and data). In particular suspicious about how synchronizing against a clock signal works, generated externally or from within.

If it can, how would I "approach" implementing that sort of protocol, breaking the complete problem down to smaller pieces? E.g program structure.

As an example I've salvaged an EEPROM from an old PCI LAN circuit, 93LC46. From the datasheet:

93LC46 Read Timing

  • CS: Chip Select ("A low level ... forces it into Standby mode")
  • CLK: Clock
  • DI: Data In
  • DO: Data Out

8-bit or 16-bit mode configured by yet another pin.

Something I suspect is significant for timing DI/DO to CLK:

enter image description here

And finally a few notes about CLK:

The serial clock is used to synchronize the communication between a master device and the 93LC46/56/66. Opcode, address and data bits are clocked in on the positive edge of CLK. Data bits are also clocked out on the positive edge of CLK. CLK can be stopped anywhere in the transmission sequence (at high or low level) and can be continued anytime with respect to clock high time (TCKH) and clock low time (TCKL). This gives the controlling master freedom in preparing opcode, address and data.

(Not asking for a complete solution, just enough to spare me wasting too much time hustling towards dead ends.)

1 Answer 1

3

This looks like a fairly straightforward SPI interface, so the standard PIO examples should work.

The only unusual feature is that the chip-select is active-high, so before triggering the PIO SPI transfer you'll need to set that pin high, then low at the end of the transfer. Just make sure the SPI clock is below 1 MHz; I'd start really slow, maybe 10 kHz.

The reason this will work is that there is no value specified for the minimum clock frequency, so you can clock the device incredibly slowly, and it will still work. Indeed, you could even start by writing some simple 'bit-bang' code to drive the clock & data lines manually, without using the PIO; you might find it easier to start this way, so you can prove the hardware is working OK, before having to tackle the more complex logic of the PIO peripheral.

1
  • Oh yeah. Without minimum frequency I could even run this device using three switches and a lightbulb.
    – Andreas
    Jan 24 at 12:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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