1

I got a Humble Pi prototyping board and build a 10-channels logic level converter using this schematic: http://i.stack.imgur.com/gS3SS.jpg

The level converter is connected directly to all communication pins: SPI, I2C, UART and a few other GPIOs.

Everything seems to be working well (I tested the channels with a multimeter and it is working, as well as I tested the I2C using a MPC23008 working at 5V) .

However when I try to use my nRF24L01+ connecting it on the 3.3V side (the 5V side I'm going to use to programme some AVRs later on) I can communicate with it, but the data is getting corrupted and the nRF24L01+ receives the wrong settings...

When I remove the Humble Pi with the level converter and connect my nRF24L01+ directly to the GPIOs it works perfectly.

What might be the problem? Is it because the SPI pins now have a 10K pull-up resistor?

What kind of tests can I do to figure out the problem?

I'm using an Raspberry Pi Model A bought from CPC Farnell less than one month ago with Raspbian.

  • 1
    Adafruit is using the same setup in their logic level converter. They say the 10K's do make the interface a little more sluggish. So it could be a speed issue. More info on this forum post: forums.adafruit.com/viewtopic.php?f=8&t=38358 – Gerben Nov 18 '13 at 20:05
1

As you suspect the 10Ks are probably the issue, SPI connections are not expected to have either pull-ups or pull-downs on them.

You would probably need to use a different method of logic level conversion. Since the SPI has uni-directional lines you can probably get away with the clock and MOSI lines connected directly to the 5v device, and the MISO line connected using a simple voltage divider into the Raspberry Pi.

If you do connect 3.3v outputs directly to a 5v device just ensure the 5v device does not accidentally drive those pins to 5v otherwise it may damage the GPIO.

  • Would change the resistors help? Maybe remove the pullup on the 3.3V side? I really want to have a level shifter to protect the Pi... – Tiago Queiroz Nov 18 '13 at 23:55
  • It might, but there is a chance that the transistor will get hot when TX_LV is 'floating' and TX_HV is high, which may lead to smoke / fire (I would need to check the data-sheet on the FET carefully). SPI is more sensitive then the other pins around this kind of problem, I really can only suggest two ideas: – PiBorg Nov 19 '13 at 10:05
  • 1. As Gerben commented have you tried using slower SPI speeds, the main problem with using pull-ups or pull-downs is they have the effect of slowing the line down – PiBorg Nov 19 '13 at 10:06
  • 2. A more complex push/pull type converter, you can get these as single chips from various sources. One example I have used before is a TXB0104 (ti.com/product/txb0104) which is capable of 3.3 to 5 translation in both directions, and should work with SPI from experience. – PiBorg Nov 19 '13 at 10:09
  • thanks a lot! I reduced the speed from 8MHz to 1MHz and now it's working perfectly!! I'll also think about buying one TXB0104. – Tiago Queiroz Nov 19 '13 at 23:41

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.