This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

non blocking Flash_Erase()

Other Parts Discussed in Thread: TMS320F28035

Hi,

I am using Picollo B DSP and I need to implement a function that writes to FLASH.

The function must be non blocking.

The FLASH function that i use to erase the sectors (Flash_Erase()) is blocking.

Is there a function that will erase the sectors but it is non-blocking? i.e. first call to the function will start the erase process, the next calls will return a status ERASE_IN_PROGRESS and when the erase proccess is finished a SUCCESS value (or error) will be returned.

I saw that there is an option to call a callback during erase, however I cannot rely on the callback to be executed in time for the other critical code to be executed.

Thanx in advance,

Adi

  • Hi!

    You have urgent stuff to handle during erasing the flash. What I know, flash cannot be used during the call of these flash api functions. But, if all your interrupt service routines are in ram and only access the ram, you can keep the interrupts turned on and your critical code can be executed. Well, I did it this way in some applications when I needed to listen to an interface port during flash api function execution.

    Best regards
    Edwin Krasser

  • Hi,

    I have a small chunk of code running from RAM and I have communication going on during FLASH erase.

    I must handle in/out communication while flash is being erased. that is why i need to have the erase operation as non blocking.

    in the data sheet i saw that interrupts must be turned off (or at least it is recommended) before calling the API functions.

    Nitsan

  • Hi,

    It's recommended to turn off the interrupts. But if they are just running in RAM it should work. Just try ;-). In my application it worked without any problems.

    Best regards
    Edwin Krasser

  • Hi,

    thanx for you response.

    I toggle a digital output in my interrupt and when i call  flash_erase() i see that the toggle rate is changed, so i guess that the interrupt is being disabled/enabled inside the API call.

    Is there any application note that specify how to use interrupts while erasing/programming the flash?

    or better is it possible that a non blocking function exists out there ?

  • Hi,

    I do not know if there exists some official document describing interrupts during flash api execution. Ok, interrupt response time changes, but is this a problem in your application? I just can recommend to try and test. And if it works, it is fine ;-).

    Best regards
    Edwin Krasser

  • Adi Ingel said:
    I toggle a digital output in my interrupt and when i call  flash_erase() i see that the toggle rate is changed, so i guess that the interrupt is being disabled/enabled inside the API call.

    Hi Adi,

    Yes interrupts are disabled during time critical chunks of code within the API.   This is described in section 14 Step 9: Optional: Disable Global Interrupts in the API readme document. 

    Section 15 Step 10: Rules for Callback, Interrupts, and Watchdog has some rules that must be followed when interrupts are enabled.

    Cheers

    Lori

  • Hello,

    I'm working with the Flash2803x_API (on a TMS320f28035) and I have some questions about the enabled interrupt and the callback function.

    In my code I put my interrupt function in RAM so that there is no problem during the Flash_Erase(), but the function is executed after the end of Flash_Erase(and I want it to be called during the Flash_Erase). Someone advised  me to look at the callback function but I don't understand how it should work. 

    I know it's not my post but could you help me?

    Thank you.

    Regards, 

    Simon Brethous