|
|
View previous topic :: View next topic |
Author |
Message |
davidgamo Guest
|
RTOS DsPIC30F6014A at 120Mhz |
Posted: Wed Sep 10, 2008 4:59 am |
|
|
Hi,
1) I want to configure a DsPIC30F6014A (with a crystal oscillator of 7.3728MHz) to 120 MHz. is it the correct configuration?
Code: | #fuses XT_PLL16,NOWDT, NOBROWNOUT, NOPUT
#use delay(clock=117952000) |
2) When I execute this code (with thew timer 1 or 4), the device sends continually to the serial port "restar: 32" and never sends "Online A", hence the device is continuously reseting and also the 32 code isn't a code for this device :
Code: |
#define RESTART_POWER_UP 0x0003
#define RESTART_BROWNOUT 0x0001
#define RESTART_WATCHDOG 0x0010
#define RESTART_SOFTWARE 0x0040
#define RESTART_MCLR 0x0080
#define RESTART_ILLEGAL_OP 0x4000
#define RESTART_TRAP_CONFLICT 0x8000
#include <30F6014A.h>
#fuses XT_PLL16,NOWDT, NOBROWNOUT, NOPUT
#use delay(clock=117952000)
#use rs232(baud=9600, UART1, STREAM=COM_A)
#use rs232(baud=9600, UART2, STREAM=COM_B)
#use rtos(timer=4, minor_cycle=50ms)
#task(rate=1000ms,max=50ms)
void request_data_task ( );
void request_data_task ( )
{
fprintf(COM_B,"Online A\r\n");
}
void main() {
fprintf(COM_B,"\r\nrestar: %u", restart_cause());
rtos_run();
} |
Thanks, |
|
|
SET
Joined: 15 Nov 2005 Posts: 161 Location: Glasgow, UK
|
|
Posted: Wed Sep 10, 2008 12:14 pm |
|
|
120MHz PLL clock will give a 30MIPS instruction clock - I think this exceeds the devices rating, datasheet indicates 20MHz as a maximum. So if your using PLL modes stick to 80MHz |
|
|
Ttelmah Guest
|
|
Posted: Wed Sep 10, 2008 3:04 pm |
|
|
Depends whether he has the -30I part or not. The commonest part is the -20E, which is rated to 20MPS. The 30I, is rated to 30MIPS, _but only using 5v, not the lower supply voltages_...
I would have the PUT enabled, or turn off the fail safe clock switching. Otherwise, depending on how long the crystal takes to start, you may find the chip oscillator switching.
I'd look at the bit patterns actually being generated by the fuses, since several options have problems on these chips - the compiler is still very 'young'...
Best Wishes |
|
|
davidgamo Guest
|
|
Posted: Thu Sep 11, 2008 10:27 am |
|
|
the device is the -30I. I set the PUT enabled, and turn off the fail safe clock switching, but the device sends continually to the serial port "restar: 32"..
I think that the compiler is still very 'young'...
Thanks |
|
|
Ttelmah Guest
|
|
Posted: Thu Sep 11, 2008 3:01 pm |
|
|
Have you looked at the assembler, to see what bit 5 in the restart_cause is actually loaded with?. It looks like it possibly ought to be 'interrupt wake up from sleep'.
Best Wishes |
|
|
Guest
|
|
Posted: Thu Sep 11, 2008 3:14 pm |
|
|
I could be way off base here, but I've just recently migrated from a PIC18F25J10 to a dsPIC30F4011, and I've noticed some problems with printf. If I don't put a delay after my printf statements, usually 3ms is enough, my string will be truncated when output to hyperterminal, and alot of times, the last character is garbage.
My theory is that the transmitter buffer is not empty before the next printf statement executes. |
|
|
|
|
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
|