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.

Illegal address when posting a semaphore inside a HWI routine (managed by dispatcher)

Hello,

I'm using a HWI routine (using DSP/BIOS 5.41.07.24), managed through dispatcher, and when calling SEM_postBinary to post a semaphore, the program goes to illegal address ISR.

Somebody could help me?

Regards

  • Carlos,

    I'm honestly not sure what could be causing that off the top of my head, but the BIOS experts might.  I'm going to move this thread over to their forums to see if they have any ideas.

    Trey

  • Hi Trey,

    Thanks a lot.

    Anyway, I'm going to give some additional information:

    I plug the HWI to the dispatcher as follows:

    	HWI_dispatchPlug(13,(Fxn)HWI_control,NULL);	
    	HWI_dispatchPlug(1,(Fxn) HWI_adc,NULL);
    HWI_control is triggered by the CPU timer 1. This routine launches a SWI routine when it is executed (using SWI_post()).
    HWI_adc is triggered whenever the ADC has new samples. It tries to post a semaphore using SEM_postBinary()
    
    
    why HWI_control works fine but HWI_adc goes to illegal address?
  • Hi Carlos,

    have you tried putting a breakpoint at HWI_adc() to see who has called it? Does it go to an illegal address every time its called?

    Which device and versions of BIOS 5 and CCS are you running?

  • Hello Tom,

    First of all, thanks for try to help me.

    Effectively, I put a breakpoint in the HWI_adc, and next a run step by step until execute the SEM_postBinary(). Then, after execute it automatically the program goes to illegal address. However, I have verified that SEM_postBinary is not the cause of the error. I have commented this line, and the program goes to illegal address again when the HWI_adc() routine reaches the '}' of the end of routine.

    So, what it is happening is that the program goes to illegal address when returning to the OS.

    Then, I changed the HWI_adc() to run without the dispatcher. Then, I modified the static configuration of this HIW module (I deselected 'use dispatcher'), I added the the ISR vector into the Pie table, I removed the line where I connected the function to the dispatcher (HWI_dispatchPug())., and I added the term 'interrupt' to the routine. The result was ok, the ISR worked perfectly. The problem is that I can't use SEM_postBinary () inside.

    The device is 28335. The BIOS version: 5_41_07_24  (the folder's name is bios_5_41_07_24).

    Regards

  • Perhaps there was a stack overflow? Using the DSP/BIOS dispatcher and calling functions like SEM_post() will use more stack space. If you trash the stack, you might overwrite the return address.

    Mark

  • I thought so, but when I checked the system stack and also the stacks of other BIOS modules they seems to be ok.

    Finally, as I couldn't run the dispatcher I decided to modify the application to run  without DSP BIOS, and now it runs fine!

    When I have more time I'll test SYS/BIOS, perhaps it run better (or I'll understand how to use).

    Thanks everybody for your help.

    Regards