chipkit wi-fire Pic32 IRQ crash

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

stefan.erni
Posts: 553
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 173 times
Been thanked: 160 times
Contact:

chipkit wi-fire Pic32 IRQ crash

Postby stefan.erni » Fri Nov 10, 2017 12:08 pm

Hi Ben

I plan to build my own board. On this board I use the same chip (Pic32MZ2048EFG100) as on the chipkit wifire.
Some part of the hardware I used in the same way as in the chipkit board. This has the Advantages I can test and write the software on the chipkit before my board gooes to manufacturing.To program it I use the Pickit3 programer on the ICSP pin.


Info_board.PNG
Info_board.PNG (432.03 KiB) Viewed 3044 times



I have still problem with the IRQ on the chipkit wifire board. In an another post you helped me and told me to change a compieler option from 01 to 0s.
When I changed it, have a message from the compieler what tells me to shop the Pro license.
Do I have some Advantages if I shop it?
"
C:\C#SOUR~1\CCS_SO~1\Flowcode\Emg_2018\Flowcode_Emg_2018_icsp1_speedtest.c:1:0: warning: Compiler option (Optimize for size) ignored because the free XC32 C compiler does not support this feature. [enabled by default]
"

But I think it will not solve the Problem from the IRQ. I wrote a small Programm with an IRQ on timer1 and an IRQ on port_a.
Both IRQ make that the program crash. The IRQ on port_a is easy to use....

IRQ_Port_a.PNG
IRQ_Port_a.PNG (37.33 KiB) Viewed 3044 times


On port_a the two switch on the chipkit board are connected. If I use the IRQ on port_a, the program runs until I press one of the button, then program crash.
Do you have a good idea?


Flowcode_Emg_2018_icsp1_speedtest.fcfx
(20.38 KiB) Downloaded 58 times

User avatar
Benj
Matrix Staff
Posts: 14660
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4651 times
Been thanked: 4269 times
Contact:

Re: chipkit wi-fire Pic32 IRQ crash

Postby Benj » Mon Nov 13, 2017 11:36 am

Hello,

We have seen this problem here, it seems specific to the PIC32MZ family.

We have reported it to the Microchip forums but so far we have not had a reply that actually helps to solve the problem.

http://www.microchip.com/forums/m969350.aspx

It's something we need to solve ASAP but I'm a bit stuck as to what to do next.

Perhaps you could chip in on the Microchip forum thread and say you are having the same issue, might help to get a solution to the issue.

stefan.erni
Posts: 553
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 173 times
Been thanked: 160 times
Contact:

Re: chipkit wi-fire Pic32 IRQ crash

Postby stefan.erni » Mon Nov 13, 2017 2:32 pm

Hi Ben

On the end of program is this C code. How I can I change this code?


------------------------------------------------------------------------------------------------------------------------------------------------

mainendloop: goto mainendloop;
return 0;
}
/*========================================================================*\
Use :Interrupt
\*========================================================================*/
//Handler code for [TMR1]
#ifndef MX_ISR_T1
#define MX_ISR_T1
void __ISR(_TIMER_1_VECTOR, ipl1AUTO) _IntHandlerDrvTmrInstance0(void)
{
IFS0bits.T1IF = 0;
FCM_irq_timer1();
}
#else
#warning "This interrupt has previously been enabled, so the macro <irq_timer1> may never get called."
#endif

User avatar
Benj
Matrix Staff
Posts: 14660
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4651 times
Been thanked: 4269 times
Contact:

Re: chipkit wi-fire Pic32 IRQ crash

Postby Benj » Mon Nov 13, 2017 4:32 pm

Hello,

The easiest way is probably to disable the interrupt enable icon and then add the code manually via the supplementary code window in the project options, this way you can directly access the code as required.
These users thanked the author Benj for the post:
stefan.erni (Mon Nov 13, 2017 5:09 pm)
Rating: 5%
 

stefan.erni
Posts: 553
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 173 times
Been thanked: 160 times
Contact:

Re: chipkit wi-fire Pic32 IRQ crash

Postby stefan.erni » Mon Nov 13, 2017 5:13 pm


stefan.erni
Posts: 553
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 173 times
Been thanked: 160 times
Contact:

Re: chipkit wi-fire Pic32 IRQ crash

Postby stefan.erni » Tue Nov 14, 2017 12:39 pm

Hi Ben

I suspect I have no way to solve the problem by myself from the IRQ.
If you can not do that from Matrix Team, I guess I have to use a different processor.

stefan.erni
Posts: 553
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 173 times
Been thanked: 160 times
Contact:

Re: chipkit wi-fire Pic32 IRQ crash

Postby stefan.erni » Wed Nov 15, 2017 10:11 am

Hi Ben

I wrote a small program.
I configutrated the IRQ Timer1 to 6HZ what means it flash the IRQ after 1/6Hz => 160mSec
If the first delay is 300mSec then only Led_3 will be turned on and then it crash
If the first delay is 100mSec then Led_3 and Led_4 will be turned on and then it crash.
I can also call the irq timer1 macro as a normal macro. It's working.
What I don'd understand is what this line is doing.
void __ISR(_TIMER_1_VECTOR, ipl1AUTO) _IntHandlerDrvTmrInstance0(void)

Digilent shows a info different....

https://learn.digilentinc.com/Documents/216

IRQ.PNG
IRQ.PNG (13.87 KiB) Viewed 2999 times

User avatar
Benj
Matrix Staff
Posts: 14660
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4651 times
Been thanked: 4269 times
Contact:

Re: chipkit wi-fire Pic32 IRQ crash

Postby Benj » Wed Nov 15, 2017 11:01 am

Hello,

The Flowcode timer interrupt function seems to match up with method 1.

void __ISR(_TIMER_1_VECTOR, ipl1AUTO) _IntHandlerDrvTmrInstance0(void)

void __ISR(_TIMER_1_VECTOR, ipl2) Timer1Handler(void)

Here is a breakdown of the meaning

void = no return
__ISR = Interrupt service routine special case
_TIMER_1_VECTOR = Interrupt vector to jump to
ipl2 / ipl1AUTO = Priority level
Timer1Handler / _IntHandlerDrvTmrInstance0 = Unique name for function
void = no parameters

You can edit the interrupt declaration by editing the code in the interrupts section of the .FCDX XML chip definition file in a text editor. Make a backup first so you can go back if needed.

From working the problem I have found the interrupt is not the problem, if the code is placed inside the interrupt function then it works as it should. It's when you call a function from the interrupt function that the crash happens. Seems to be a problem specific to the MZ family.

To see what we have tried to solve the problem you can see the report here on the Microchip forum.
http://www.microchip.com/forums/m969350.aspx

I am very willing to get this problem resolved but so far everything I have tried hasn't yielded any results.

stefan.erni
Posts: 553
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 173 times
Been thanked: 160 times
Contact:

Re: chipkit wi-fire Pic32 IRQ crash

Postby stefan.erni » Wed Nov 15, 2017 12:14 pm

Hi Ben
I appreciate your support.

I found a info in the
MPLAB® XC32 C/C++ Compiler User’s Guide

micromips /MIPS32 ISA has to be correct defined.

In the PIC32MZ2048 pdf is this in CONFIG3 register
These bits are set based on the value of the BOOTISA Configuration bit (DEVCFG0<6>).

How can I see what is in the CONFIG3 the bit16 set ? or how can we toggle it?

"
Note: Some PIC32 target devices allow the exception/interrupt code to be in
either the MIPS32® or microMIPS™ ISA mode via a device configuration bit
(BOOTISA). On these devices, if your BOOTISA bit is set to microMIPS
mode, add the 'micromips' attribute to your interrupt function. If your
BOOTISA bit is set to MIPS32 mode, add the 'nomicromips' attribute to your
interrupt function. See your device data sheet for more information on this
configuration bit."

User avatar
Benj
Matrix Staff
Posts: 14660
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4651 times
Been thanked: 4269 times
Contact:

Re: chipkit wi-fire Pic32 IRQ crash

Postby Benj » Wed Nov 15, 2017 1:04 pm

Hello,

The configuration bit value is set in the Chipkit bootloader firmware. If you have a PICkit 3 then you can create a Flowcode project for the raw chip instead of via the bootloader and use the PICkit to program the device. This will give you access to the configuration bits via the usual place in the project options.

stefan.erni
Posts: 553
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 173 times
Been thanked: 160 times
Contact:

Re: chipkit wi-fire Pic32 IRQ crash

Postby stefan.erni » Wed Nov 15, 2017 1:26 pm

Hi Ben

I'm using already the PICkit3 with the CPU. I changed to mips32.
And it's working!!! Thank You Ben.

Mips32.PNG
Mips32.PNG (4.61 KiB) Viewed 2985 times
These users thanked the author stefan.erni for the post:
Benj (Wed Nov 15, 2017 2:17 pm)
Rating: 5%
 

User avatar
Benj
Matrix Staff
Posts: 14660
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4651 times
Been thanked: 4269 times
Contact:

Re: chipkit wi-fire Pic32 IRQ crash

Postby Benj » Wed Nov 15, 2017 2:22 pm

Wow that's fantastic, many thanks for letting us know your findings and really pleased you are now able to continue with the PIC32MZ device.