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

dsPic30F6012A won't run

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



Joined: 04 Mar 2009
Posts: 16

View user's profile Send private message

dsPic30F6012A won't run
PostPosted: Wed Mar 04, 2009 6:21 pm     Reply with quote

I have a professionally produced circuit board of my own design with a dsPic30F6012A process and a 10mhz crystal. I had an older ICD-U40 and it wouldn't program. I bought a new one and the programming seems to work. Verify says it's correct. Problem is no blinking LED! I am a very experienced programmer with 18Fs and older, but this one is driving me nuts. LEDs are on PIN_G2 and PIN_G3. I am using latest CCS compiler and 24 bit wiazrd with minimal options.

Anyone have a super simple code snippet I can try?

Are the wire lengths to the ICD super critical (about 18" right now)?

Again, it seems to program, but not run. Debug doesn't seem to work either.

Thanks
Guest








PostPosted: Thu Mar 05, 2009 9:35 am     Reply with quote

Update, processor runs and i can say "Hello World" through the serial port. Problem is, individual output lines are not working.

Code is simple:
Code:
main()
{

output_high(pin_g7);

etc . . .

}

pin does not go high . . .
andreluizeng



Joined: 04 Apr 2006
Posts: 117
Location: Brasil

View user's profile Send private message Send e-mail MSN Messenger

PostPosted: Thu Mar 05, 2009 1:45 pm     Reply with quote

post the list part so we can see what is going on... but anyway, have you tried to set this pin high without ccs built-in function ???

Code:

#byte PORT_G = 0x2E6
#bit PIN_G7 = PORT_G.7

#byte TRIS_G = 0x2E4
#bit TRIS_G7 = TRIS_G.7


and then..

Code:


main()
{

      TRIS_G7 = 0;  // output
      PIN_G7 = 1;  //high

etc . . .

}



regards.
_________________
Andre
nostep



Joined: 04 Mar 2009
Posts: 16

View user's profile Send private message

PostPosted: Thu Mar 05, 2009 7:01 pm     Reply with quote

Andre,

Good idea, I'll try that Friday and let you know.

Thanks,

John
nostep



Joined: 04 Mar 2009
Posts: 16

View user's profile Send private message

PostPosted: Fri Mar 06, 2009 5:28 am     Reply with quote

The above code didn't work. I had to change pin_g7 to pins_g7 because pin_g7 was already defined. Still didn't turn the port on.
nostep



Joined: 04 Mar 2009
Posts: 16

View user's profile Send private message

PostPosted: Fri Mar 06, 2009 7:00 am     Reply with quote

OK, I have lots of IO pins working now, except for G7 and G8. I think it may have to do with the second function of these pins. Datasheets call out CN9 for pin G7 and CN10 for G8. How does one disable the "Capture Notification" feature on these pins? The third function of the pins, SPI2 is already disabled.
andreluizeng



Joined: 04 Apr 2006
Posts: 117
Location: Brasil

View user's profile Send private message Send e-mail MSN Messenger

PostPosted: Fri Mar 06, 2009 7:46 am     Reply with quote

could you post your entire code here ? including header file, so we can see better how you are initializating your dsPIc.

regards.
_________________
Andre
nostep



Joined: 04 Mar 2009
Posts: 16

View user's profile Send private message

PostPosted: Fri Mar 06, 2009 8:04 am     Reply with quote

Code:
-------------------------------------------------------
main4.c
-------------------------------------------------------

#include "main4.h"

#use rs232(UART1,baud=9600,parity=N,bits=8)

void main()
{
setup_spi(SPI_SS_DISABLED);
setup_spi2(SPI_SS_DISABLED);

setup_wdt(WDT_OFF);
setup_timer1(TMR_DISABLED);

set_tris_g(0x00);

while(1)
  {
  output_high(PIN_G7);
  output_high(PIN_G8);

  printf("Hello World\n");
  delay_ms(1000);
  }
}

Code:
-------------------------------------------------------
main4.h
-------------------------------------------------------

#include <30F6012A.h>

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES XT_PLL4
#FUSES PR_PLL                   //Primary Oscillator with PLL
#FUSES NOCKSFSM                 //Clock Switching is disabled, fail Safe clock monitor is disabled
#FUSES WPSB16                   //Watch Dog Timer PreScalar B 1:16
#FUSES WPSA512                  //Watch Dog Timer PreScalar A 1:512
#FUSES PUT64                    //Power On Reset Timer value 64ms
#FUSES NOBROWNOUT               //No brownout reset
#FUSES BORV47                   //Brownout reset at 4.7V
#FUSES LPOL_HIGH                //Low-Side Transistors Polarity is Active-High (PWM 0,2,4 and 6)
   //PWM module low side output pins have active high output polar
#FUSES HPOL_HIGH                //High-Side Transistors Polarity is Active-High (PWM 1,3,5 and 7)
   //PWM module high side output pins have active high output polarity
#FUSES NOPWMPIN                 //PWM outputs drive active state upon Reset
#FUSES MCLR                     //Master Clear pin enabled
#FUSES NOPROTECT                //Code not protected from reading
#FUSES NOWRT                    //Program memory not write protected
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES NOCOE                    //Device will reset into operational mode
#FUSES ICS0                     //ICD communication channel 0
#FUSES RESERVED                 //Used to set the reserved FUSE bits

#use delay(clock=40000000)
andreluizeng



Joined: 04 Apr 2006
Posts: 117
Location: Brasil

View user's profile Send private message Send e-mail MSN Messenger

PostPosted: Fri Mar 06, 2009 8:39 am     Reply with quote

it seems like the notification change (second function of the pin) is working, so you have to disable it.

lets try the following code regarding to disable CN interrupt:

main4.h
Code:

#byte IEC0 = 0x008C // if it is already defined, then ignore this code and use the defined one
#bit CNIE = ICE0.15


main4.c

Code:

#use rs232(UART1,baud=9600,parity=N,bits=8)

void main()
{
        setup_spi(FALSE);
        setup_spi2(FALSE);

        setup_wdt(WDT_OFF);
        setup_timer1(TMR_DISABLED);

        disable_interrupts (GLOBAL);  // disable global interrupts

         CNIE = FALSE;  // disable CNIE interrupt

        set_tris_g(0x00);

        while(1)
        {
             output_high(PIN_G7);
             output_high(PIN_G8);

             printf("Hello World\n");
             delay_ms(1000);
        }
}


hope to get luck in this time

regards.
_________________
Andre
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Fri Mar 06, 2009 10:57 am     Reply with quote

Peripheral modules as SPI or change notification are disabled by default. There's no need to disable them initially
(it doesn't hurt, of course, but only if you do it correctly).
Code:
setup_spi2(SPI_SS_DISABLED);
actually enables SPI2, just removing this instruction leaves it disabled and hopefully recovers PIN_G7 and PIN_G8 operation.
setup_spi2(FALSE) would be correct for disable, I think.
nostep



Joined: 04 Mar 2009
Posts: 16

View user's profile Send private message

PostPosted: Fri Mar 06, 2009 11:05 am     Reply with quote

DUDE, YOU TOTALLY ROCK! Works Great!
andreluizeng



Joined: 04 Apr 2006
Posts: 117
Location: Brasil

View user's profile Send private message Send e-mail MSN Messenger

PostPosted: Fri Mar 06, 2009 11:29 am     Reply with quote

alright..


now good luck with your project.


regards.
_________________
Andre
nostep



Joined: 04 Mar 2009
Posts: 16

View user's profile Send private message

PostPosted: Fri Mar 06, 2009 12:38 pm     Reply with quote

Thanks, I appreciate everyones help.
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