ΣSigmaStudio Ask AI Русский Log in

Error  on doing file operations in NMI ISR

Processors & DSP superccxin Dec 17, 2011 00:00 3 replies Original on forum ↗
Subscribe
superccxin Question
Dec 17, 2011 00:00

Hi all!

I'm using the watchdog timer to generate a NMI interrupt so that i can save something before my system reset(doing reset in NMI ISR). But whlie I made some file operations(like adi_FileOpen,adi_FileWrite, etc...) in NMI service routine, error ocurred! I even could not get out of the first file operation such as adi_fileopen!

Cannot I make some file operations in the NMI ISR?

By the way, I'm using the VisualDSP++ update 6.

thanks for all replies!

walle chen

nmi

isr

superccxin Reply
Dec 19, 2011 00:00

Hi,

I found that I cannot even execute the adi_fss_FileClose() in any ISR function like:

EX_INTERRUPT_HANDLER(Timer_ISR)

{

/* my other works */

...

if(fh!=NULL)

adi_fss_FileColse(fh);

/* do something else next,but never reach*/

...

}

Or

static ADI_INT_HANDLER(NMIHandler)

{

if(fh!=NULL)

adi_fss_FileClose(fh);

bfrom_SysControl(SYSCTRL_SYSRESET,0,NULL); // NEVER reach here to cause a reset signal

return(ADI_INT_RESULT_PROCESSED);

}

Is it not allow to make some file operations in ISRs? I really need to sava some infomations before my DSP power off or reset. What other ways should I do if file operations donot support in ISRs?

Thanks for all replies!

Walle chen

ADIApproved Reply
Jan 17, 2012 00:00

Hi,

first, we would recommend applying the latest update to the VisualDSP++ 5.0 tools - Update10 - as Update 6 was released some time ago, and further improvements have been made to the FSS, USB, etc.

The FSS PIDS use semaphores as access locks and to pend on data completion. Pending on semaphores at ISR level is illegal under VDK. The PIDs and the 'raw pid' interface make use of the SSL semaphore service which by default leverages the VDK semaphore API in a VDK application.

There is only one way to overcome the problem and that is to use the 'standalone' semaphore service for the PIDs, and to avoid its use in thread code. The simplest way to use the standalone semaphore service is to add Blackfin\lib\src\services\sem\adi_sem_standalone.c to your project to override the VDK variant in the kit library.

Clearly, under such conditions the semaphore service API must not be used in any additional application code as it would prevent the correct functioning of the VDK scheduler.

Regards,

Craig.

EZAdministrator Reply
Aug 2, 2018 00:00

This question has been assumed as answered either offline via email or with a multi-part answer. This question has now been closed out. If you have an inquiry related to this topic please post a new question in the applicable product forum.

Thank you,
EZ Admin