Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

MDBT40 SWRST Pin to 5V MCU Directly?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

MDBT40 SWRST Pin to 5V MCU Directly?

by mrnoisytiger on Sun Jul 12, 2020 6:38 pm

I'm planning a project with an AT90USB1286 and the MDBT40 that Adafruit sells. I don't want to end up using their Breakout Board to keep costs down and to save on board space. Therefore, I'm trying to recreate their breakout board directly on my PCB instead.

My circuit is primarily only 5V on the power rails, so I'm using a 3.3V LDO regulator to drop it down to 3.3V for the MDBT40. I'm also using a Level Shifter for the SCK and MOSI signals, and wiring the MISO directly to the µC, which should be able to handle a 3.3V input signal just fine.

However, I noticed that there is an N-Channel MOSFET between the 3.3V SWDIO/RST pin of the MDBT and the 5V Reset output hole on the BoB. Does anyone know what this is even for? I can't really seem to understand the purpose of this MOSFET.

Can I instead wire the SWDIO pin of the MDBT40 directly to my MCU, or do I need to shift that down to 3.3V too? I'd rather avoid that if I can to save on BOM costs.

I'm looking at the schematic for the breakout board https://cdn-learn.adafruit.com/assets/assets/000/026/205/original/adafruit_products_BluefruitLESPIFriend_sch.png?1436186237. The MDBT40 module I'm looking to use is https://www.adafruit.com/product/4076.

mrnoisytiger
 
Posts: 5
Joined: Sun Jul 12, 2020 6:26 pm

Re: MDBT40 SWRST Pin to 5V MCU Directly?

by mrnoisytiger on Mon Jul 13, 2020 12:39 am

Looks like the image I wanted to include didn't actually make it into the post.

Screen Shot 2020-07-12 at 9.30.16 PM.png
Screen Shot 2020-07-12 at 9.30.16 PM.png (133.91 KiB) Viewed 23 times


Researching some "level shifting" implementations, this actually just appears to be a bi-directional level shifter from 3.3V to 5V [VIN]. This "exact" layout was found https://hackaday.com/2016/12/05/taking- ... -shifters/. The fact that this even exists or works is news to me, but it looks like it's something I'll have to include in my circuit.

mrnoisytiger
 
Posts: 5
Joined: Sun Jul 12, 2020 6:26 pm

Re: MDBT40 SWRST Pin to 5V MCU Directly?

by adafruit_support_mike on Wed Jul 15, 2020 3:20 pm

Yep, that's an I2C level shifter. The product page for this breakout has links to a couple of datasheets that describe the circuit:

https://www.adafruit.com/product/757

In general, yes you do need the level shifter when connecting a 3.3V I2C bus to a 5V I2C bus. Many/most 3.3V devices will die if you connect 5V directly to one of their IO pins. There are also a bunch of wierd edge cases involving chips getting power through the IO pin when they're supposed to be shut down, or external devices being pulled to unexpected voltages.

adafruit_support_mike
 
Posts: 61422
Joined: Thu Feb 11, 2010 2:51 pm

Re: MDBT40 SWRST Pin to 5V MCU Directly?

by mrnoisytiger on Wed Jul 15, 2020 3:23 pm

adafruit_support_mike wrote:Yep, that's an I2C level shifter. The product page for this breakout has links to a couple of datasheets that describe the circuit:

https://www.adafruit.com/product/757

In general, yes you do need the level shifter when connecting a 3.3V I2C bus to a 5V I2C bus. Many/most 3.3V devices will die if you connect 5V directly to one of their IO pins. There are also a bunch of wierd edge cases involving chips getting power through the IO pin when they're supposed to be shut down, or external devices being pulled to unexpected voltages.


Awesome. Thank you for the explanation. It seems that MISO is the one pin that does not actually get it's logic level adjusted. Is this simply due to the fact that it is an output instead of an input, so there's no chance of a 5V logic level from the µC causing damage?

Additional Question: It seems like the SPI Friend is using the 74LVC2G34DBVR to level shift SCK and MOSI. If I instead replace that IC with a similar 3-channel level shifter instead and tie SWDIO/RST to that, as opposed to the discrete MOSFET circuit, would that also work? I assume it would have to be a fancier bi-directional level shifter like the TXB0104/TXB0108, instead of the one-way ones like the 74LVC, since SWDIO goes both ways.

mrnoisytiger
 
Posts: 5
Joined: Sun Jul 12, 2020 6:26 pm

Re: MDBT40 SWRST Pin to 5V MCU Directly?

by adafruit_support_mike on Sun Jul 19, 2020 1:29 am

mrnoisytiger wrote:It seems that MISO is the one pin that does not actually get it's logic level adjusted. Is this simply due to the fact that it is an output instead of an input, so there's no chance of a 5V logic level from the µC causing damage?

Yep, that's right.

Current is what kills parts. In mechanical terms, it's equivalent to momentum: a combination of how much mass you have and how fast it's moving. Voltage is the amount of energy it takes to push a given amount of current through a given impedance. Input pins have high impedance, so very little current can flow through them unless the voltage is insanely high. Their job is to be easy for some external signal to move. Output pins have low impedance so they're strong enough to move other things. A 5V input pin has about the same effect on a 3.3V output pin as a soap bubble landing on a brick. OTOH, a 5V output connected to a 3.3V input has about the same effect as a brick landing on a soap bubble.

mrnoisytiger wrote:It seems like the SPI Friend is using the 74LVC2G34DBVR to level shift SCK and MOSI. If I instead replace that IC with a similar 3-channel level shifter instead and tie SWDIO/RST to that, as opposed to the discrete MOSFET circuit, would that also work?

That gets into how you want to use the circuit.

The SPI Friend uses an I2C-style level shifter so the reset circuit can travel both directions without causing problems for any other source of a reset signal. The general term for it is a 'distributed AND gate': as long as all the inputs are high, the output will also be high. If any single input goes low, the output will also go low. But more importantly, the inputs have no effect on each other. All the low impedances connect to the same voltage (GND), and all the connections to other voltages are isolated by high impedances.

mrnoisytiger wrote:I assume it would have to be a fancier bi-directional level shifter like the TXB0104/TXB0108, instead of the one-way ones like the 74LVC, since SWDIO goes both ways.

Not necessarily.

The TBX0104 can pass signals both directions, but it can't control the impedance of any other signal it's connected to. If it's trying to pull high while you have a pushbutton shorting the same trace to GND, you'll have problems.

The first question is whether you need both the 5V and 3.3V sides to be able to generate a reset. We added that capability to make the board more general, but your specific application might not need it. If you can live with a one-way signal, you can just level-shift it from the side that will generate the signal to the side that will accept the signal.

adafruit_support_mike
 
Posts: 61422
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.