Error in code generation for dsPic/Scicos Pack V8

A forum useful to discuss the details of the ScicosLab code generator.

Moderator: paolo.gai

paolo.gai
Administrator
Posts: 875
Joined: Thu Dec 07, 2006 12:11 pm

Re:Error in code generation for dsPic/Scicos Pack V8

Post by paolo.gai » Wed Oct 14, 2009 3:35 pm

Dear Ofir,

We found the problem. (Thanks Dario for the help!)

The block you are using is one of the oldest blocks we wrote for the FLEX boards. The block accepts a parameter, which is stored into the \"IPAR\" variable generated by the Scilab code generator.

The code has been tested and worked fine on the first versions of the code generator. Then, we never used the block again, because we mainly use the demo board internally.

Then, to reduce the amount of RAM used by the generator, Roberto correctly put the IPAR variable as \"const\", storing it into flash memory, read-only.

Unfortunately, during initialization, the block read the IPAR variable, implements a saturation (the parameter can be between 1 and 8), writing it back to the IPAR variable.

In the newest version of the code generator, being IPAR set as CONST, the write to the IPAR variable makes the dsPIC issue an Alignment trap, resetting the device.

We fixed the problem and committed it into the SVN.

If you need to use the block, please do the following:

- go into C:/Evidence/Evidence/eclipse/plugins/com.eu.evidence.ee_1.0.0.XXX (the one with the latest date)

- then go inside ee_base/contrib/scicos/src/pic30/flex_adcin.c

- in the function init, comment out the line

Code: Select all


//block->ipar[0]=pin;
At the end, the function should look like:

static void init(scicos_block *block)
{
[...]
//block->ipar[0]=pin;

/* turn off ADC module */
AD1CON1bits.ADON = 0;

[...]

Then save it and Enjoy :-)

If you are using Vista, you may then have some permission problem, so to be sure go back in the plugin directory, and do a chmod +rw on the plugins.

Again, thanks for pointing out this problem!

Ciao,

Paolo

ofirbo
Newbie
Posts: 19
Joined: Sun Oct 26, 2008 11:18 am

Re:Error in code generation for dsPic/Scicos Pack V8

Post by ofirbo » Wed Oct 14, 2009 4:20 pm

It worked.

Thank you and the team for the great support :-]

Regards,
Ofir

paolo.gai
Administrator
Posts: 875
Joined: Thu Dec 07, 2006 12:11 pm

Re:Error in code generation for dsPic/Scicos Pack V8

Post by paolo.gai » Thu Oct 15, 2009 3:57 pm

Dear Ofir,

could you please try the new COFF file we put in the Scicos Pack 8.1? that one should work fine (the previous one had some problems...)

PJ

Locked