Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Mixing 5V and 3.3V problems

Status
Not open for further replies.

camerart

Well-Known Member
Hi,

I want to control an SX1278 with an 18LF2520 PIC with LCD, and program it with a Pickit3.

The SX1278 is a 3.3V MAX device and needs SPI to set it up, plus other connections.

The 18LF2520 will work on 3.3V or 5.V

The PICKIT3 uses 5V (5V suggested in the set-up) to program the PIC.

From tests, I've found that a 5V LCD will power from 5V and work with 3.3V DATA.

When wiring the circuit (using fuse wire) I connected the Pickit3 external power to the 3.3V. After programming the PIC runs if I use the external power from the Pickit3 circuit, but not when powering the circuit with it's 3.3V regulator.

I can't tell yet, but I will most likely have blown the radio circuit?

Can anyone tell me how I should have wired it up, to allow 5V programming, while not blowing the 3.3v units please?

Camerart
 
Last edited:
You don't need 5V programming, set the PICKit3 to program with 3.3V (or use external power to the circuit, rather than using the PICKit to power it).

But is there any specific reason you're doing it this way?.

LCD needs 5V, SX needs 3.3V, PIC needs either.

Why not run the PIC at 5V and only the SX at 3.3V? - it's commonly done that way in Arduino circles (as they are mostly 5V only), and use series resistors in the SPI lines.
 
Hi

What are you using with the Pk3, old Mplab IDE, MPlabX or Pk3 Stand alone program ?

Whichever it is, there is a tool /option check box to select Target power only , so that should ensure its only programmed with target voltage.

PIC runs if I use the external power from the Pickit3 circuit,

Again , whatever IDE/program you are using, there is a box to specify what VDD voltage you want the Pk3 to supply, have you changed that ?

Regarding running the LCD on 5v, cannot say with 100% cetainty, but I believe under certain circumstances the LCDs 5v can run back down the data lines to even power up the 2520, so there is a chance that it may have damaged the radio chip.
With your whole circuit powered with 5v and 3v3 have you checked what voltage shows on the 3v3 rail ?

As for you circiut only running from Pk3 power, have you programmed in Debugger mode ? have you got Mcle set to off or with 10k pull up ?

Using fuse wire - sounds a bit dangerous being uninsulated ?
 
You don't need 5V programming, set the PICKit3 to program with 3.3V (or use external power to the circuit, rather than using the PICKit to power it).

But is there any specific reason you're doing it this way?.

LCD needs 5V, SX needs 3.3V, PIC needs either.

Why not run the PIC at 5V and only the SX at 3.3V? - it's commonly done that way in Arduino circles (as they are mostly 5V only), and use series resistors in the SPI lines.

Hi N,

When changing the Voltage to 3.3V I was faced with this, see image:

I have other circuits with series resistors, but wasn't getting the correct results, so bought the lower voltage PICs to eliminate this possible reason.

Another reason was for the reverse signal from MISO where the SX1278 would try to send signals at 3.3V to the 5V PIC. I guessed that this wasn't quite right.

My Pickit3 has an external power source of 5V.

C.
 

Attachments

  • VDD.jpg
    VDD.jpg
    6.5 KB · Views: 268
Hi N,

When changing the Voltage to 3.3V I was faced with this, see image:

Presumably you have set MPLAB to use the LF version of the chip?, and not just the F version.

Another reason was for the reverse signal from MISO where the SX1278 would try to send signals at 3.3V to the 5V PIC. I guessed that this wasn't quite right.

3.3V signals feeding a 5V PIC are perfectly fine.

My Pickit3 has an external power source of 5V.

How do you get an external power supply to the PICKit?, or do you mean an external power supply to the target?.
 
Hi

What are you using with the Pk3, old Mplab IDE, MPlabX or Pk3 Stand alone program ?

Whichever it is, there is a tool /option check box to select Target power only , so that should ensure its only programmed with target voltage.



Again , whatever IDE/program you are using, there is a box to specify what VDD voltage you want the Pk3 to supply, have you changed that ?

Regarding running the LCD on 5v, cannot say with 100% cetainty, but I believe under certain circumstances the LCDs 5v can run back down the data lines to even power up the 2520, so there is a chance that it may have damaged the radio chip.
With your whole circuit powered with 5v and 3v3 have you checked what voltage shows on the 3v3 rail ?

As for you circiut only running from Pk3 power, have you programmed in Debugger mode ? have you got Mcle set to off or with 10k pull up ?

Using fuse wire - sounds a bit dangerous being uninsulated ?

Hi W,

I'm just learning MPLABX and now you ask, I notice that I was using MPLAB.IPE as the programmer. See reply above for the voltage question.

When powered normally, the PIC and the SX1278 are 3.3V with 5V going to the power of the LCD. The SX has clamped voltage on the PINs of 3.3V and I've tried 5V to them, which is clamped at 3.3V, but I think not for long! When using my setting of 5V for the programmer everything is at 5V (Not good)

I don't know debugger mode?

MCLR is set ON, with 10K pull-up, and 68R for re-set.

I agree, my bright idea of making a 'quick' circuit with fusewire wasn'y my best. It's a bit spaghetti like.

C.
 
Presumably you have set MPLAB to use the LF version of the chip?, and not just the F version.



3.3V signals feeding a 5V PIC are perfectly fine.



How do you get an external power supply to the PICKit?, or do you mean an external power supply to the target?.

Hi N,

MPLAB set for LF.

3.3v ok.

EDIT: The Pickit3 is powered by USB and has an external power supply (if button pressed), which powers the target with 5V.

C.
 
Last edited:
Hi,
Today I changed the MPLAB power settings to 3.375V, and powered the programming with the Pickit3. Then switched on the circuit (3.3V to PIC) no result. When powered by the Pickit3 xternal 5V circuit the PIC showed results. So the PIC can be programmed at 3.3V but it won't run until 5V is fed to it.
C.
 
All sounds very messy.

As Nigel suggested, might be better running it all at 5v apart from the 3v3 to the input device which can use logic level shifters on its i/o lines.

Have a read though this thread which shows both resistor potential dividers and the cheap 4050 chip (Maplin etc) methods.
You can of course buy many of the ready made logic level converter boards.
https://forum.arduino.cc/index.php?topic=285735.0
 
All sounds very messy.

As Nigel suggested, might be better running it all at 5v apart from the 3v3 to the input device which can use logic level shifters on its i/o lines.

Have a read though this thread which shows both resistor potential dividers and the cheap 4050 chip (Maplin etc) methods.
You can of course buy many of the ready made logic level converter boards.
https://forum.arduino.cc/index.php?topic=285735.0
All sounds very messy.

As Nigel suggested, might be better running it all at 5v apart from the 3v3 to the input device which can use logic level shifters on its i/o lines.

Have a read though this thread which shows both resistor potential dividers and the cheap 4050 chip (Maplin etc) methods.
You can of course buy many of the ready made logic level converter boards.
https://forum.arduino.cc/index.php?topic=285735.0

Hi W,
It is a bit messy, but it is a quick test to check a few points.
I read the link and from #17 onwards, it points out some of the difficulties, I have been having using the same method, this is why I chose to go for all 3.3V devices.

Internal 8mHz.
C.
 
Have got a 2550 chip so will get it out and check that it runs on a separate external 3v3 line....
 
Have got a 2550 chip so will get it out and check that it runs on a separate external 3v3 line....
Hi W,
Much appreciated.

Are they 18LF1520? this is what I'm using.

In a day or so, I will be able to re-build a circuit with a proper etched board, if this saves you the effort.

C.
 
Hi,
A suggestion from another forum, pointed me to the configuration bits and BOR. I switched BOR from MAX to MIN and the PIC is now flashing it's LED and results on the LCD. Unfortunately, the SX1278 is a bit quiet :(
Thanks to all.
C
 
Hi,

Have just programmed my 18F2520 chip, its the standard type, not the LF with my Pk2.

I can program it using Mplab Old IDE V8.92 with a vdd of 5v and also 3v3.
It loads the program fine at both voltages.

While still powered from the Pk2, it runs the program fine at 3v3 or 5v.

I then disconnected the Pk2 form the 2520 and connected it to an external psu and it runs fine a 5v and 3v3 .

So if the standard chip can do that, no reason the LF cannot.

As far as I can see from the datasheet the LF should still be able to run at 8mhz on 3v3, you could just check your settings are correct and you have set it to 8mhz and not something must higher by mistake.

Try what I have just done as simple LED 1 second flasher on Port B , code below.
 

Attachments

  • flash1sec.HEX
    568 bytes · Views: 197
Your entry #14 only came in while I was typing my last reply.

Boren has 2 settings, the SBoren is the software controlled part, Boren specifies if hardware or software should be used.
Setting Boren= OFF or 0x00 just turns that function off, as many suggest doing so as it can be almost too active.

Full details in the datasheet secion 23 , configuartion bits.

Any doubts then post the first part of your code.
 
Your entry #14 only came in while I was typing my last reply.

Boren has 2 settings, the SBoren is the software controlled part, Boren specifies if hardware or software should be used.
Setting Boren= OFF or 0x00 just turns that function off, as many suggest doing so as it can be almost too active.

Full details in the datasheet secion 23 , configuartion bits.

Any doubts then post the first part of your code.

Hi W,
My program is in Oshonsoft BASIC, but I'm in transistion to MPLABX.

My BOR setting show BOR ON/OFF I left this ON. Then BOR voltage MAX/MIN, I changed to MIN. this got my PIC working.

C.
 
Like Nigel, I used Pic chips with Assembly code, while good it was limiting in todays world.

From the little I know of Basic is also very limiting in the Libraries avaialable.

Evereyones different, however Basic is quiet similar in many ways to C++, so my suggestion would be to move on to the Arduino platform rather than MplabX and C.

All you need is a Arduino Uno (or the very good clone Arduino Uno boards , £5 from many uk places ) with the free Arduino IDE and countless libraries and modules.
No programmer needed, totally effective bootloader and you can test your code live on the Uno board with feedback to the PC screen.
 
Hi,

Have just programmed my 18F2520 chip, its the standard type, not the LF with my Pk2.

I can program it using Mplab Old IDE V8.92 with a vdd of 5v and also 3v3.
It loads the program fine at both voltages.

I've always wondered if there are actually any differences between the two chips, or if they just stick different labels on identical ones :D

Same with 4MHz and 20MHz versions, I've never seen a 4MHz one that didn't work perfectly at 20MHz - and even higher.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top