How to configure PLL and maintain correct time

Post Reply
coolj
Posts: 16
Joined: Mon Nov 29, 2010 7:31 pm

How to configure PLL and maintain correct time

Post by coolj » Mon Nov 29, 2010 7:42 pm

Lubin - great blockset!

I'm currently evaluating if this would work for my current application.

I have the explorer 16 board with your example code up-and-running on it.

However, I am trying to understand how to increase the MIPS of the dspic33fj256gp710 to the max 40 mips without affecting the base time step of the model.

That is, I want to have the fastest processing speed, but maintain accurate real-time time steps. When I increase the dspic master to 40 MIPS, it clearly affects the time step of the model (the LEDs blink much faster, for example).

Can you help me understand how to increase the model to 40 MIPS and maintain the correct real-time time step?

Much appreciated!
Justin

LubinKerhuel
Site Admin - Expert
Posts: 616
Joined: Wed Mar 07, 2007 11:23 pm
Location: Bayonne- France
Contact:

Re: How to configure PLL and maintain correct time

Post by LubinKerhuel » Mon Nov 29, 2010 9:03 pm

coolj wrote:When I increase the dspic master to 40 MIPS, it clearly affects the time step of the model (the LEDs blink much faster, for example).
Are you increasing the speed using the MASTER block ?
Time step should not be affected (make sure you recompile the model. Perhaps try to compile it twice ! (to make sure change are taken into account))

Please report it that's not working ! (bug ?)

Lubin

coolj
Posts: 16
Joined: Mon Nov 29, 2010 7:31 pm

Re: How to configure PLL and maintain correct time

Post by coolj » Mon Nov 29, 2010 9:30 pm

Thanks for the lightning-fast response, Lubin!

Yes, I increased the speed using the master block "Activate PLL" with MIPS=40000000. In fact, this is the only thing that I changed from the default example model for the explorer 16 board. It appears that the time step followed that, as the LEDs look to be blinking approximately 10x faster than before.

R2010b, blockset 3.3.

I tried re-compiling it again as you stated, but it's clear that changes are being implemented as when I uncheck "Activate PLL", the MIPS go down to 4e6 (as expected), and the LEDs blink at the correct rate.

I even tried compiling the project in MPLAB, with the same "fast time step" results.

Is there anything else I should try?

LubinKerhuel
Site Admin - Expert
Posts: 616
Joined: Wed Mar 07, 2007 11:23 pm
Location: Bayonne- France
Contact:

Re: How to configure PLL and maintain correct time

Post by LubinKerhuel » Mon Nov 29, 2010 10:47 pm

Are you using a bootloader ?
Bootloader typically do not program config registers where PLL and others parameters are stored.

Otherwise, Could you upload the modified model on the forum ? Something's wrong !

Lubin

coolj
Posts: 16
Joined: Mon Nov 29, 2010 7:31 pm

Re: How to configure PLL and maintain correct time

Post by coolj » Tue Nov 30, 2010 7:12 am

No bootloader being used. I'm programming it directly from ICD3.

I attached the model - it's exactly the same as the explorer 16 demo but with the PLL activated for 40 MIPS (based on the 8 MHz Explorer 16 xtal).
Attachments
dsPIC_33f_Explorer16.hex
compiled hex file
(15.71 KiB) Downloaded 533 times
dsPIC_33f_Explorer16.mdl
Explorer 16 model with activated PLL @ 40 MIPS
(43.03 KiB) Downloaded 665 times

LubinKerhuel
Site Admin - Expert
Posts: 616
Joined: Wed Mar 07, 2007 11:23 pm
Location: Bayonne- France
Contact:

Re: How to configure PLL and maintain correct time

Post by LubinKerhuel » Tue Nov 30, 2010 8:41 am

Could you check that, in MPLAB, the configuration bits are also programmed (because there is a checkbox option in MPLAB that force the configuration options bits with the current GUI config...)

Lubin

coolj
Posts: 16
Joined: Mon Nov 29, 2010 7:31 pm

Re: How to configure PLL and maintain correct time

Post by coolj » Tue Nov 30, 2010 7:14 pm

Hi Lubin,

I believe I have the configuration bits set correctly in MPLAB to read from program code - I attached a screenshot for your verification.

I also attached the exact window showing the updated MIPS / PLL setting.

Justin
Configuration Bits
Configuration Bits
PLL_settings.png
PLL_settings.png (23.63 KiB) Viewed 16015 times

coolj
Posts: 16
Joined: Mon Nov 29, 2010 7:31 pm

Re: How to configure PLL and maintain correct time

Post by coolj » Tue Nov 30, 2010 8:00 pm

RESOLVED.

For some reason, a re-load of Matlab seemed to solve the problem...anyway, it's working great now!

Thanks for your help, Lubin!

Justin

LubinKerhuel
Site Admin - Expert
Posts: 616
Joined: Wed Mar 07, 2007 11:23 pm
Location: Bayonne- France
Contact:

Re: How to configure PLL and maintain correct time

Post by LubinKerhuel » Tue Nov 30, 2010 11:31 pm

Thanks for illustrating what I was talking about the Configuration bits. The picture shows a correct configuration.

Good to see the blockset working now.
Provided you could reproduce the bug, I would be glad to get the how you did so as to correct that problem !

Lubin

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests