FORUM TOPIC · READ ONLY

ICS configured incorrectly

ICS configured incorrectly

Forum : bug reports

13 message(s) · archive en lecture seule

bmairs
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

Re: ICS configured incorrectly

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

Re: ICS configured incorrectly

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

Re: ICS configured incorrectly

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

Re: ICS configured incorrectly

Citation : LubinKerhuel

_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

Re: ICS configured incorrectly

Hi Bryant,
Citation : bmairs
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 ?


Citation : bmairs
These constants you suggest are not available

I did not get it



Lubin
bmairs

Re: ICS configured incorrectly

_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

Re: ICS configured incorrectly

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

Re: ICS configured incorrectly

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.
bmairs

Re: ICS configured incorrectly

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

Re: ICS configured incorrectly

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

Re: ICS configured incorrectly

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