Flash_Erase with Timer Interrupt problem

General discussion on mikroC PRO for dsPIC30/33 and PIC24.
Post Reply
Author
Message
lololafripouille
Posts: 231
Joined: 25 Mar 2014 17:11

Flash_Erase with Timer Interrupt problem

#1 Post by lololafripouille » 06 Mar 2017 11:31

Hello,

I use a dsPIC33EP512MC806 with VTFT v461 and MikroC dsPIC 701.
I use internal Flash to store an array of 16 byte.

All is working great, I store values in array and after a reset, read and print values on TFT.
But If I add a Timer interrupt ( Timer 2 triggers every 25ms ), calling the function Flash_Erase reset my MCU and Timer 2 interrupt no longer works.

There is nothing in the interrupt function, just a flag incremented and then resetted in the main - while(1) function.

I can't publish my code right now, i'm sorry.

Do you have any idea ?
Thank you for your help :)

lololafripouille
Posts: 231
Joined: 25 Mar 2014 17:11

Re: Flash_Erase with Timer Interrupt problem

#2 Post by lololafripouille » 06 Mar 2017 13:11

Hello again.

I managed to solve my problem.
Maybe it can be usefull.

Instead of

Code: Select all

void Timer6Interrupt() iv IVT_ADDR_T6INTERRUPT ics ICS_AUTO
I used

Code: Select all

void Timer6Interrupt() org 0x4A000 iv IVT_ADDR_T6INTERRUPT ics ICS_AUTO
0x4A000 was empty and far from the address Flash I use and far from the memory usage of my program.

Is it possible to have an explanation from a C master/guru why it was not working without the org directive ?
It will be nice if I could understand why :)

Thank you :)

lololafripouille
Posts: 231
Joined: 25 Mar 2014 17:11

Re: Flash_Erase with Timer Interrupt problem

#3 Post by lololafripouille » 08 Mar 2017 11:04

Hello,

I made again some change in VTFT and now, calling the function Flash_Erase reset my MCU....again.

If I delete the org directive in Time6Interrupt, it works !

I don't understand why. If I can have some info from MikroE team it will be great.
I don't understand the memory alignment, maybe it is a problem of the Address I choose to write on Flash.
I choose a multiple of 0x800 ( 0x51000 )

Thank you for your time.

User avatar
danilo.milovic
mikroElektronika team
Posts: 501
Joined: 05 Dec 2016 14:59

Re: Flash_Erase with Timer Interrupt problem

#4 Post by danilo.milovic » 09 Mar 2017 12:39

Hi,

can you please send whole project file in .zip archive? So I can have clear picture what is going on in your code.

Regards,

Danilo

jalal_am
Posts: 57
Joined: 07 Jul 2012 16:17

Re: Flash_Erase with Timer Interrupt problem

#5 Post by jalal_am » 05 Sep 2019 22:46

Hi,
have anyone found a solution fo this problem. I have same problem with dsPIC33ep512MU810.

I would be grateful if you share a solution.

Thank you

Post Reply

Return to “mikroC PRO for dsPIC30/33 and PIC24 General”