News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

5v to 3.3v USART

Started by joesaliba, Jul 06, 2023, 07:57 AM

Previous topic - Next topic

joesaliba

Hi,

I know this topic has been discussed in other threads, but this is a bit different.

I have a PCB board ready where I can attach external modules. This board will get information from various modules, process the information and then send it to another module.

It happen that I changed this last module where all the data is sent, and it requires, 1 wire transmission, 3.3v logic, inverted data transfer.

The one wire and inverted data is solved. Can I use just a resistor in series to lower from 5v to 3.3v the USART?

As I am using a one wire transfer, I am using a diode to connect PIC Tx to PIC Rx, with PIC Rx connected directly to module, and Tx is connected through a diode, 1n4148.

Am I correct to say that as the transmit from PIC is going through the diode, I already lowered the voltage with 0.7v?

If so, would a resistor lower the other 1v, or can I go with 2 diodes in series and I should have no problem?

Regards

Joe


david

Hi Joe,
Use a voltage divider to go from a 5V source to a 3.3V input.  A single series resistor will not do what is needed.
Also  - using diodes as voltage droppers is not ideal.  Provided the current is a few mA it will produce a voltage drop of 0.6-0.7V but if the current is very small the drop may only amount to only 200-300mV.  Also think about the diode when the source signal goes to ground - the diode is zero biased and you must have a resistor from the rx input to ground to stop things floating.  Diodes will also introduce a modest thermal component also but I doubt you're expecting operation over a range of -30C to +85C.

Cheers,
David

tumbleweed

It's unclear to me what the purpose of the diode is... depending on how the diode is oriented there's always a condition where the pic TX pin is going to conduct through the diode when the external signal drives it, effectively shorting the TX output.

Either way it doesn't allow the TX output to drive both high and low.
Is there a pullup/pulldown involved in there somewhere?


joesaliba

Quote from: david on Jul 06, 2023, 09:23 AMHi Joe,
Use a voltage divider to go from a 5V source to a 3.3V input.  A single series resistor will not do what is needed.
Also  - using diodes as voltage droppers is not ideal.  Provided the current is a few mA it will produce a voltage drop of 0.6-0.7V but if the current is very small the drop may only amount to only 200-300mV.  Also think about the diode when the source signal goes to ground - the diode is zero biased and you must have a resistor from the rx input to ground to stop things floating.  Diodes will also introduce a modest thermal component also but I doubt you're expecting operation over a range of -30C to +85C.

Cheers,
David

Thanks David,

I will try this method soon.

Regards

Joe

joesaliba

Quote from: tumbleweed on Jul 06, 2023, 11:08 AMIt's unclear to me what the purpose of the diode is... depending on how the diode is oriented there's always a condition where the pic TX pin is going to conduct through the diode when the external signal drives it, effectively shorting the TX output.

Either way it doesn't allow the TX output to drive both high and low.
Is there a pullup/pulldown involved in there somewhere?



Tumbleweed,

As the module I have is single wire, I do not  want the module to transmit to PIC Tx pin, if Tx pin is low.

Therefore, anode of diode is connected to PIC Tx pin, and cathode is connected to PIC Rx pin.

Module single wire is connected to PIC Rx pin.

Therefore, if the module is transmitting, the PIC will receive to Rx pin, but high level is blocked with diode to Tx pin.

I have approximately 4ms to wait for a character and send back the data I want, therefore, I have sort of control of the transmission time from PIC.

I tried without the diode but it does not work. I think that, as the USART is inverted, it idles low, therefore I was short the module signal.

Regards

Joe

tumbleweed

Unless you invert the TX output, the uart output is high in the idle state.

That would short the output when the module drives a low as the diode would conduct.