View previous topic :: View next topic |
Author |
Message |
alex80
Joined: 05 Nov 2019 Posts: 4
|
Problem using UART2 in release mode ... |
Posted: Tue Nov 05, 2019 8:57 am |
|
|
Hello,
I am new in this forum but I regularly refer to some topics.
I have a problem using the UART2 of a dsPIC30F3013. I use MPLAB X 3.51 and CCS PCD compiler and my goal is very simple (see code below): I want to continuously send 2 characters on the serial port.
I compile and download the program with "Make and Program Device Main Project". I watch the U2TX pin with an oscilloscope. The program works perfectly as long as the programmer/debugger (Pickit 3) is connected. When I turn off the power, unplug the Pickit 3 and i power the microcontroller again, the U2TX pin no longer emit any characters.
Do you have an idea of the problem ? The future electronic card will have to be autonomous and the program will be more complex than this one.
Thank you.
Alex
Code: |
#include <30F3013.h>
#fuses FRC_PLL8, NOWDT, NOPROTECT, NOBROWNOUT, NODEBUG
#use delay (clock = 58960000) // 7.37 MHz Internal RC oscillator, 8x PLL enabled.
#use rs232 (STREAM = robot, UART2, baud = 38400, parity = N, bits = 8, ERRORS)
void main () {
delay_ms (1000);
do {
fputc ('#', robot);
delay_us (300);
fputc ('F', robot);
delay_us (300);
} while (TRUE);
}
|
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19566
|
|
Posted: Tue Nov 05, 2019 8:59 am |
|
|
Classic one is no pullup on the MCLR pin. Chip won't run unless this pin is
pulled high and the programmer does do this, Something like a 20K
resistor on this to Vdd. |
|
|
alex80
Joined: 05 Nov 2019 Posts: 4
|
|
Posted: Tue Nov 05, 2019 9:33 am |
|
|
Hi Ttelmah,
Thanks for your response.
I already have a pullup resistor (10K) between MCLR and VDD.
If I blink an LED instead of emitting a character ... the program is working properly !!
Alex |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19566
|
|
Posted: Tue Nov 05, 2019 9:52 am |
|
|
Are you sure you have programmed a _release_ version of the code?.
If you are working in MPLAB, this has to explicitly be done. A debug release
will run while the debugger is attached, but not without. |
|
|
alex80
Joined: 05 Nov 2019 Posts: 4
|
|
Posted: Tue Nov 05, 2019 10:04 am |
|
|
I'm not absolutely sure. I use the "Make and Program Device Main Project" button in MPLAB X.
Is there another way to configure the release mode? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19566
|
|
Posted: Tue Nov 05, 2019 12:52 pm |
|
|
On the current releases of MPLAB-X use the big green arrow button on
the toolbar. It's an arrow down pointing into a chip. It automatically
switches to release mode, and programs the chip. By default MPLAB
builds with it's default configuration and if you have an ICD selected, this
is debug mode. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9254 Location: Greensville,Ontario
|
|
Posted: Wed Nov 06, 2019 8:09 am |
|
|
just a comment...
You can change the 'default' build mode in MPLAB v8.86 and later. I've set mine to 'release' several years ago since I always burn then test in the real World.
I don't know what happens with 'ICD', again, not the way I work...
Jay |
|
|
alex80
Joined: 05 Nov 2019 Posts: 4
|
|
Posted: Sun Nov 17, 2019 3:14 pm |
|
|
Thank you for your responses.
I finally solved the problem. It was a hardware problem. There was a bad reset at power on.
I added an MCP100 on the MCLR pin and a capacitor beteween VDD and VSS. Now all is fine.
Thanks.
Alex |
|
|
|