ICS configured incorrectly

Post Reply
bmairs
Posts: 69
Joined: Mon Jul 27, 2009 7:51 pm

ICS configured incorrectly

Post by bmairs » Tue May 04, 2010 6:31 pm

I've updated to the recent blockset version to 3.2b and I think I've found a bug. I have odd problems running my code where once it attempts to send a CAN message it halts. This does not occur if I open the generated source in MPLAB, though it asks me about fixing the ICS configuration bits before I run it there.

The exact prompt MPLAB gives me is:
The configuration bits in the file are invalid and may cause problems if programmed.
Do you want to set them to their default value? [YES/NO]
Please note you will need to either rebuild the file or export memory again to correct the file.
Config Field: ICS
This has resulted in the standard compilation path of compile in MATLAB and download via the PICkit2 impossible. My only option is to open the generated source in an MPLAB project and load it that way.

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

Re: ICS configured incorrectly

Post by LubinKerhuel » Tue May 04, 2010 11:14 pm

Hi Bryant,

A new field was added in the master block about In Circuit debugging : ICD communication channel. Default is set to none and this "default" value cause this error.

Could you set it to another value than none ? typically, ICS_PGD1 would be fine.
let me know if you still have the same problem.

Lubin

bmairs
Posts: 69
Joined: Mon Jul 27, 2009 7:51 pm

Re: ICS configured incorrectly

Post by bmairs » Wed May 05, 2010 12:00 am

I've tried PGD1, but that didn't fix the problem. It also breaks programming via MPLAB.

Before you made this change, what were the default values for the JTAG and ICD? Those seemed to work earlier, so I'd like to use those again. I don't have any old compilations to check the source from.

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

Re: ICS configured incorrectly

Post by LubinKerhuel » Wed May 05, 2010 12:23 am

it depends on the chip used :

MB stand for Master block options...
pic30 :
_FICD( MB ICD ) line did not exist in earlier code

pic33:
_FICD( JTAGEN_OFF ) replace in code by _FICD( MB JTAG & MB ICD )

pic24f:
_CONFIG1( JTAGEN_OFF & GCP_OFF & GWRP_OFF & COE_OFF & FWDTEN_OFF & ICS_PGx2)
replaced with
_CONFIG1( MB JTAG & GCP_OFF & GWRP_OFF & COE_OFF & FWDTEN_OFF & ICS_PGx2)

pic24h :
_FICD(MB JTAG & MD ICD ) line did not exist in earlier code

Did you also updated C30 compiler ?
There may be option or flags changed when compiler is launched.

bmairs
Posts: 69
Joined: Mon Jul 27, 2009 7:51 pm

Re: ICS configured incorrectly

Post by bmairs » Wed May 05, 2010 5:15 pm

LubinKerhuel wrote: _FICD( JTAGEN_OFF ) replace in code by _FICD( MB JTAG & MB ICD )
These constants you suggest are not available even if I inject an underscore in them, so the above isn't a solution. Can I obtain the functionality from the last blockset version in this one? I don't want to have to modify the source code everytime I try to compile something.

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

Re: ICS configured incorrectly

Post by LubinKerhuel » Wed May 05, 2010 6:04 pm

Hi Bryant,
bmairs wrote:Can I obtain the functionality from the last blockset version in this one?
I am not sure to get it. if you want to test, I can override theses new options inside C code with their default value, to get similar C code from old blockset. did you mean this ?
or do you prefere to revert to old blockset ?
bmairs wrote:These constants you suggest are not available
I did not get it

Lubin

bmairs
Posts: 69
Joined: Mon Jul 27, 2009 7:51 pm

Re: ICS configured incorrectly

Post by bmairs » Wed May 05, 2010 6:08 pm

_FICD( JTAGEN_OFF ) replace in code by _FICD( MB JTAG & MB ICD )
That line you suggested replacing will not compile. It says both the "MB JTAG" and "MB_JTAG" symbols are not found. I have also tried deleting the whole _FICD line, but that didn't resolve the issue either.

I just want my code to work again and I'm confused as to why the defaults which were working before were changed to something that now doesn't work. I'm hoping I can make adjust the settings so that I can use this updated blockset, especially once you add the ECAN blocks I'll want to use it. If my code can't run using your updated versions of the blocksets, that's a problem.

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

Re: ICS configured incorrectly

Post by LubinKerhuel » Thu May 06, 2010 7:34 am

Hello Bryant,

I didn't make it clear enough: MB (for Master Block) JTAG and MB ICD in the new blockset version are replaced by the parameters options taken from dsPIC Master Block (simulink). If you look at generated code, you will see it.

In previous blockset version, it was not possible to precise theses options.
They were added as someone asked for it.

Anyway, default options taken by theses new parameters compile properly but cause a warning when opening files with MPLAB. This warning was not an issue as code worked fine (as far as I tested it).

I'll send you a blockset without theses new options. However, the problem probably comes from somewhere else. I already see with MPLAB some code working when running in debug mode, but not working in release mode! This was a really weird thing.

Lubin

Ender
Posts: 38
Joined: Thu Oct 09, 2008 5:20 pm
Location: Phoenix USA _ Grenoble Fr

Re: ICS configured incorrectly

Post by Ender » Thu May 06, 2010 8:34 pm

Just a track:
The difference between code working in debug and not in debug is usually for some peripheral interrupts.
Often, the problem come from the WDT, which is enable with a bad setting and reset (or else) the chip after a short while.
In debug mode the WDT is disable but in release mode, it can be enable in the code or in the Mplab config setting.

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

Re: ICS configured incorrectly

Post by LubinKerhuel » Sun May 09, 2010 9:50 am

Another difference between compilation within MPLAB and MATLAB is pointed out on this post : (not in the correct topic, I'll try to move it)

http://www.kerhuel.eu/forum/viewtopic.p ... ECAN#p1162

bmairs
Posts: 69
Joined: Mon Jul 27, 2009 7:51 pm

Re: ICS configured incorrectly

Post by bmairs » Mon May 10, 2010 8:32 pm

So at this point I'm not certain that the problem is I'm running into. I've tried versions 3.1, 3.2b, and the 3.3a that Lubin sent me and I'm running into the same problem with all of them: Code works just fine when imported into MPLAB and run in either the Debug or Release mode. It does not work, however, when being using the .hex file generated by MATLAB and pushed via PicKit2. I am able to transmit a single CAN message and then the processor hits either an infinite loop or halts (either is possible with my code). Transmission does use an interrupt, which could be the problem as it's triggered after the message is transmitted.

bmairs
Posts: 69
Joined: Mon Jul 27, 2009 7:51 pm

Re: ICS configured incorrectly

Post by bmairs » Fri May 14, 2010 11:01 pm

So I've updated my ECAN code to now use a circular buffer for transmission and skip the blocking infinite loop that I had in the my code previously. This was where the code was getting stuck, and I wasn't sure why. Right now I'm testing my code with the new 3.2b version, though I don't think I'll have a problem now.

bmairs
Posts: 69
Joined: Mon Jul 27, 2009 7:51 pm

Re: ICS configured incorrectly

Post by bmairs » Fri May 14, 2010 11:18 pm

The new version of the blockset isn't a problem. Looks like things are running fine over here now.

Post Reply

Who is online

Users browsing this forum: No registered users and 13 guests