SparkFun Forums 

Where electronics enthusiasts find answers.

All things pertaining to wireless and RF links
By andyledford
#21107
I have a question regarding interfacing PICs to the nRF24L01 -- specifically in a situation where the PIC is operating at 5 volts and the nRF24L01, of course, is operating at 3.3 volts. While I understand that the nRF's inputs are 5-volt-tolerant so that accepting inputs from the PIC is not a problem, my question deals with the reverse case; that is, when an nRF output is attempting to drive a PIC input.

The nRF datasheet notes that the output voltage for any output is at least Vdd-0.3v and no greater than Vdd. Since Vdd cannot be greater than 3.6 volts, no output can source a signal greater than 3.6 volts, and would likely output less than this since Vdd is probably closer to 3.3 volts and the output can be less than maximum. However, every PIC datasheet I've examined states that the minimum high input voltage (Vih) is 0.8 Vdd for inputs with Schmitt-trigger buffers. (Inputs such as SPI In and INT all utilize Schmitt-trigger buffers.) Since Vdd for the PIC is nominally 5 volts, that means that the minimum Vih is 4 volts, which is greater than the maximum output of the nRF.

I have built a couple of test circuits with 5-volt PICs and 3.3-volt nRFs, and these specific implementations work; however, I'm leery of actually going to production with such an arrangement knowing that the "official" specifications say it won't work. In the planned production device, space and power consumption must be kept to an absolute minimum, so additional circuitry to level-shift these signals is not attractive.

Even so, I've looked at a number of schemes for "simple" level shifting. One simple expedient would appear to be use pull-up resistors on the PIC inputs (or built-in weak pull-ups if available), but I'm hesitant to take this approach since the nRF datasheet is silent on the issue of imposing a higher-than-Vdd voltage on the outputs. Since no information is provided regarding the actual structure of the outputs, I can't assess whether over-voltage would cause harm. I've also read the Phillips Application Note AN97055 presenting MOSFET-based level shifting, but using that approach would require extra parts and current as well as requiring a slower SPI speed. Bipolar or MOSFET transistors could also be used in more conventional ways, but again with parts, space, and power costs.

So... I'm wondering if I've misinterpreted the specs in some way that makes this seem like a problem when it actually is not, or if others out there have any helpful advice to mitigate the issue. Any insight would be greatly appreciated.

Thanks much.
User avatar
By leon_heller
#21108
Just using pull-ups should be OK (the resistor should ensure that the safe voltage on the output isn't exceeded), or you could use a 3.3 V version of the PIC.

Leon
By andyledford
#21139
Thanks for the reply, Leon. Using a 3 volt supply for the PIC wouldn't be my first choice because of other elements/requirements in the circuit -- but it is an option.

I'm concerned about using pull-ups because I don't know, for instance, whether the nRF outputs have structures that would effectively clamp the high-signal voltage to, say, Vdd. I mention this because of an inadvertent test I did. In my test circuits, nRF IRQ is connected to PB0 (INT) of a PIC 16F873A. I had the scope connected to this line and observed that while IRQ was in the inactive (high) state, the voltage was about 3.3 V -- just what I would have expected. However, as I was subsequently reviewing the PIC code, I noticed I had inadvertenly enabled weak pull-ups on Port B; therefore, PB0 (INT) actually had a pull-up to 5 volts. However, the high voltage on the pin apparently was clamped at 3.3 V.

If this is so, then not only does a pull-up not solve the problem, but it also would be just another current leak -- those electrons from the 5 volt supply must be going somewhere!

Anyway, that's part of why I'm concerned. Thanks again for your reply.

Andy
By brennen
#21143
Why not just use a level translator? Somebody had the schematic for one from Maxim on here a month or so ago, but I can't remember the part name (you can probably search for level translator or something like that to find it). There's also one in the 74 series logic chips (which I also can't remember the name for) that's relatively simple.
By andyledford
#21186
Thanks for the reply. I may have to use a translator (you're right about Maxim and TI making several different types, as well as the 74LVDxxx series made by Phillips, Fairchild, and others), but I'd really like to avoid it if possible. The extra circuit costs money, space, and power -- none of which I'd like to add to the final product.

There's always a problem, isn't there? I guess that's what makes engineering fun -- trying to do the most-est with the least-est!

Thanks again.
By brennen
#21187
There's always a problem, isn't there? I guess that's what makes engineering fun -- trying to do the most-est with the least-est!
I couldn't have said it better myself. :lol:
By andyledford
#21309
I posed this same question to Nordic Technical Support and received the following reply:

------------------------------------
"The 5V tolerant inputs of the 24L01 means it can handle 5v signals, but can't drive more than Vdd. So you are correct about your asumptions. The output pins can't handle more than Vdd, so a pull-up is not a good idea. The output stage is a transistor in series with a inverting transistor with the output pin between the two. So a higher level than VDD will cause over voltage on the low side transistor.

So if your MCU can't handle Vdd-0.3V (max. 3.3V) as the high level, you either need to use level converters between or swich to a low voltage controller or a controller that can handle a lover VH level.

0.8V VDD seems pretty high. Most controllers use 0.6-0.7 VDD. Even if your circuit works now, you might run into troubles in production. Another batch might have different caracteristics.

I'd look for another MCU. Ideally with the same operation voltage as the 24L01. You can then use the same regulator and a low voltage MCU will in any case use less power than a 5v one."
-----------------------------------------

So, I see two lessons-learned: 1) Using 5-volt PICs with the nRF24L01 is not a good idea, and 2) the folks at Nordic are to be complemented for their support of their customer base. It's always nice when a big business takes the time and trouble to deal with the little guy.
By brennen
#21313
I wouldn't say that using 5V PICs with nRF24L01s is necessarily a bad thing, but you do need some additional hardware. A couple of transistors or, at worst, a hex inverter chip would be fine for interfacing the two. Neither is particularly expensive, and with surface mount conponents, they shouldn't take up much board space, either.

After inspection of the datasheet for the 18F4520 datasheet (the PIC I use from time to time), the inputs for RC3 and RC4 (SPI clock and data input, respectively) actually require 0.7Vdd to trigger(page 337 in the "Input High Voltage" section under parameter D041, second line). This gives you 3.5V as the threshold, which is still a bit low for your application.