![]() |
Forum Index : Microcontroller and PC projects : Level-shifting modules
Author | Message | ||||
Tinine Guru ![]() Joined: 30/03/2016 Location: United KingdomPosts: 1646 |
I realise that they are often cited for such things as SPI and I2C so I was puzzled to find the following. Came from the comments section Can anyone vouch for these things in a high-speed application? Craig |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10310 |
Certainly work fine for me in I2C at 400KHz. Choice of mosfet is important and its not impossible that some modules may be out there with incorrect parts |
||||
PeterB Guru ![]() Joined: 05/02/2015 Location: AustraliaPosts: 655 |
Craig. I2C is inter integrated circuit which means very short cables. Level shifters use a resistor to charge cable capacitance. So for long cables there will be a speed limit. Peter(B) |
||||
Tinine Guru ![]() Joined: 30/03/2016 Location: United KingdomPosts: 1646 |
Hmmm, I'm looking at MHz. I actually only need uni-directional. Reading more and more claims of being "too slow". I think I might go with the CD4050BE instead ![]() Craig |
||||
Tinine Guru ![]() Joined: 30/03/2016 Location: United KingdomPosts: 1646 |
Hi Peter, I'm dealing with a bunch of 5v incremental encoders that I need to drop to 3v3. In most cases, we're talking a few hundred KHz but this can easily get up to MHz. Craig |
||||
PeterB Guru ![]() Joined: 05/02/2015 Location: AustraliaPosts: 655 |
Craig. (again) If cables are more than a foot or so it could well be worth while going to opto- couplers. That will also solve the level shifting problem. Peter(B) And you are in a high noise environment I think. Edited 2022-05-30 17:54 by PeterB |
||||
Tinine Guru ![]() Joined: 30/03/2016 Location: United KingdomPosts: 1646 |
Cables are >10m. Encoders are equipped with differential line-drivers that feed my (MC3486) line-receivers. This is all standard stuff. It's the output from the 5v line-receivers that I need to drop to 3v3. Craig |
||||
phil99![]() Guru ![]() Joined: 11/02/2018 Location: AustraliaPosts: 2640 |
For input only, try a simple voltage divider between the line receiver and 3.3V input pin. Try 1k and 2.2k for a start. Lower values may allow higher speeds but need more drive current. |
||||
Tinine Guru ![]() Joined: 30/03/2016 Location: United KingdomPosts: 1646 |
Unfortunately, this is not something that I can experiment with because the entire machine needs to be powered-up. I cannot simulate with my desktop motor-rig. These are HUGE motors and mechanically decoupling (for safe testing) isn't an option. I'm just gonna go with the CD4050s. ![]() Craig |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 5089 |
Hi Tinine, There are 2 different types of levels shifters - unidirectional ones: these are the simplest and most reliable, and can be purchased in various speeds, up to the GHz range. A simple 74LVT04 part can perform these functions shifting UP and shifting DOWN. But also a simple voltage divider can succeed. - bidirectional level shifters. This is mainly I2C application, but we have seen SPI (as PS2 keyboard) and other applications. These level shifters typically have an active level, and a passive level. The level shifters discussed before have active low level, and passive high level. The passive level is typically achieved by a pullup resistor. The active level by a FET. In case of the picomite, the active level is achieved by the (relatively weak) output pin of the RP2040 (50 ohm), in series with the FET (10 ohm) in the level shifter. And the combination of these should ensure a reliable LOW level, when driving the pullup resistor. This determines the value of the pullup resistor (i.e. 10k, 5k or 2k). The pullup resistor value (in combination with capacitance in the circuit) determines the maximum frequency you can use on this level shifter. In practice you will see that 400kHz I2C will already violate the I2C specification when driving more that 1 I2C device on the bus. That does not say that it does not work. But you will see some devices that may not work, while many will. Philips have developed special I2C driver chips for longer I2C busses that have very strong drivers that can work with 100 ohm or 500 ohm pullup resistors. These chips will allow longer I2C busses, and absorb more capacitive load. But these drivers also have speed limits. Dear Tinine, If you want to have a high speed level shifter, please make sure you design around unidirectional signals in your bus. So SPI using separate data in and data out (not PS2). Unless 400kHz is enough, and you have short (low capacitance) wiring. PicomiteVGA PETSCII ROBOTS |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2170 |
Only I2C is bidirectional (out of the two discussed) and maximum of 400KHz, so that you are asking for MHz tells me you are looking at SPI(?). If so, then the signal lines are uni-directional. Consider using a bus buffer chip. With VCC=5V, Vih of 3V is a high enough "1" to be recognised OK and you won't have the lag of a relying on a resistor for pull-up. It will go to several MHz but maybe not the 20MHz maximum specified for SPI. But I bet there is some variant that will or at least approach it... easy 10Mhz https://www.onsemi.com/pdf/datasheet/74vhc240-d.pdf Edited 2022-05-30 19:21 by CaptainBoing |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 5089 |
Tinine, Look at AM26LV32E. This is a quad high speed diff line receiver (32MHz) for 3.3V No need for level shifter.... Volhout Edited 2022-05-30 19:29 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
Tinine Guru ![]() Joined: 30/03/2016 Location: United KingdomPosts: 1646 |
Look at AM26LV32E. This is a quad high speed diff line receiver (32MHz) for 3.3V No need for level shifter.... Volhout Many thanks, guys ![]() I have lots of pending orders for my controller and so the big problem right now is to design with components that are not in short supply: -Propeller P2...no problem -Pico...no problem -Older DIP devices...no problem Stuff that I would ideally like to use: Problem ![]() Craig |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2170 |
if you can live with 10MHz (still pretty bleedin' quick) 74VHC240 in stock and available at many sources https://www.ebay.co.uk/sch/i.html?_from=R40&_trksid=p2380057.m570.l1313&_nkw=74vhc240&_sacat=0 |
||||
Tinine Guru ![]() Joined: 30/03/2016 Location: United KingdomPosts: 1646 |
For a line-receiver, I'm really comfortable with the MC3486, been using it for years. For the level-shift, the big suppliers have plenty of CD4050Bs. I don't see much risk, here ![]() Craig |
||||
Quazee137![]() Guru ![]() Joined: 07/08/2016 Location: United StatesPosts: 593 |
Have a look Mouser All my other distributors are many weeks too. |
||||
Tinine Guru ![]() Joined: 30/03/2016 Location: United KingdomPosts: 1646 |
These guys appear to be kicking butt right now: I had a look on AE and grabbed 100 "CD4050"s, shipped for ten quid. Too risky for my controller but I'll test a few on my desktop rig. Craig |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |