Created Sun, 12 Apr 2015 21:53:55 +0000 by nickanor
Sun, 12 Apr 2015 21:53:55 +0000
Hi.
I am new to the forum.
I have completed a program for uno32.
When I upload it to the board through mpide it works great. But when uploading it through MPLAB IDE 8.92 and picKit 3 , pin 13 can only drive a LED with very low intesity. I can measure 2v on pin 13 when it is not loaded, and 1.7 v when loaded with a LED. I have also checked some other pins and voltage is 2V when activated and not loaded. Nevertheless I am driving big relays on other pins through ULN2003 and they work great. Perhaps (probably) the voltage is also low on the pins for the relays but i didn't notice because ULN2003 makes the hard job.
If I restore the bootloader and upload through mpide the problem dissappears.
I have tried with different boards, and same reults.
I am powering the board from a car battery and a 7809 to Vin pin.
I haven't tried with MPLAB X.
I don't have the slightest idea of what's going on.
Any idea?
Sun, 12 Apr 2015 22:13:38 +0000
Can you share your code with us? Both versions - the MPIDE and MPLAB versions?
Mon, 13 Apr 2015 12:56:56 +0000
In fact I have written more than one thousand lines of code. I will try to make a smaller program with the significative lines of code and I will share.
By the way, I tried with MPLAB X yesterday and same results. Hughe voltage drop.
I analized the output with the oscilloscope and it is not an issue of the voltage going up and down like a PWM signal for an effective voltage of 1.7 V. It is a constant voltage of 1.7 V.
I will be traveling a few days, so it will take me some days to post again with the code.
Thank you very much majenko for your reply, and for all the excellent support you have provided through all the forum. I have been following the forum for months and it has helped a lot.
Mon, 13 Apr 2015 13:03:43 +0000
I forgot to say that the mpide and the MPLAB versions are the same. I just compile the mpide version with the non-bootloader variant in mpide, create the .hex, and load the .hex with MPLAB.
Mon, 13 Apr 2015 13:04:04 +0000
I forgot to say that the mpide and the MPLAB versions are the same. I just compile the mpide version with the non-bootloader variant in mpide, create the .hex, and load the .hex with MPLAB.
Mon, 13 Apr 2015 13:51:34 +0000
So you're writing your code with pure register access? Not using things like pinMode() and digitalWrite()?
Mon, 13 Apr 2015 14:20:05 +0000
No.
I am using piMode() and that stuff.
I compile with mpide, nonbootloader version and then load the hex with MPLAB. The program works either with mpide and bootloader and MPLAB-pickit3. But I need a non bootloader versión because of faster response when reseting and known state when reseting.
Mon, 13 Apr 2015 14:21:42 +0000
I forgot to saythe program works with either mpide and MPLAB, but I have this issue with voltage drop.
Mon, 13 Apr 2015 15:22:16 +0000
How are you using pinMode() etc in MPLAB?
Tue, 14 Apr 2015 12:37:07 +0000
I only use MPLAB to load the hex file generated by mpide with the nonbootloader version of the linker.
So as far as I can think of, I use pinMode in exactly the same way in either MPLAB and mpide.
Wed, 15 Apr 2015 09:28:10 +0000
Oh, ok, so you're just using MPLAB as a programmer, not compiling anything in there.
So the only difference is the linker script you're compiling with?
Wed, 15 Apr 2015 14:39:35 +0000
So Arduino pin 13 on an Uno32 is tied to PIC32 pin 4, which is PMA5/SCK2/CN8/RG6. I checked the board file, and this particular pin has nothing else connected to it on the Uno32 board. Just the PIC32 pin 4 straight to the header.
So unless your PIC32 part is damaged somehow (which seems unlikely since it does work sometimes) I don't think there is a hardware problem.
The other peripherals on that pin (PMA5/SCK2/CN8) also seem like they would not be causing the voltage drop on that pin.
Now, re-reading your first post in this thread, it's not clear to me if the voltage drop you see is ONLY while programming, or actually it's there even when your sketch is running. Can you clarify?
It seems to me that you might be accidentally depending on some action of the bootloader. When you program the HEX file using MPLAB, you are not programming a bootloader on, correct? Just the raw sketch? If so, then anything the bootloader is doing won't get done when you use MPLAB to program, and thus if there is some pin setup done by the bootloader on that pin, it would not be done in your case.
Another way to test this is to make a really simple sketch that uses just raw port accesses, and see if you see the same difference.
For example, void setup(void)
And try programming this sketch both ways to see if you can still see the difference.
*Brian