CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Problem using UART2 in release mode ...

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
alex80



Joined: 05 Nov 2019
Posts: 4

View user's profile Send private message

Problem using UART2 in release mode ...
PostPosted: Tue Nov 05, 2019 8:57 am     Reply with quote

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: 19515

View user's profile Send private message

PostPosted: Tue Nov 05, 2019 8:59 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Nov 05, 2019 9:33 am     Reply with quote

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: 19515

View user's profile Send private message

PostPosted: Tue Nov 05, 2019 9:52 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Nov 05, 2019 10:04 am     Reply with quote

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: 19515

View user's profile Send private message

PostPosted: Tue Nov 05, 2019 12:52 pm     Reply with quote

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: 9226
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Nov 06, 2019 8:09 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Nov 17, 2019 3:14 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group