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.

DSP28335 read IFR not possible?

Hello together,

 

i am searching the documentation and google for an answer to my problem but didn't find anything so i ask you.

 

I am using a 28335 DSP (with Code Generation Tools 5.2.6) and i try to read the value of the IFR register to a local 16bit unsigned interger variable.

Unfortunately the compiler denies this command with the message "Illegal use of control register". According to the users guide spru514c this error occures because of limited instructions of the architechture, but the register is expicit read AND write capable.

 

spru078f tells the following: "To identify pending interrupts, use the PUSH IFR instruction and then test the
value on the stack. Use the OR IFR instruction to set IFR bits and use the AND
IFR instruction to manually clear pending interrupts. All pending interrupts are
cleared with the AND IFR #0 instruction or by a hardware reset."

Do i have to implement the access to this register in assembler? Writing to IFR is possible just as well as reading and writing to IER.

 

Does somebody know whats wrong?

 

Thanks,

Helmut

  • Helmut,

     

    Helmut Rahn said:
    Unfortunately the compiler denies this command with the message "Illegal use of control register". According to the users guide spru514c this error occures because of limited instructions of the architechture, but the register is expicit read AND write capable.

    Yes, this is correct.    IFR read/write is limited and done inside the CPU via special opcodes to perform an AND and OR. 

    It would be dangerous to modify it otherwise because a new interrupt could come in between a "read" and a "write" and get lost.   Using these special instructions this does not occur.

    Helmut Rahn said:
    Unfortunately the compiler denies this command with the message "Illegal use of control register". According to the users guide spru514c this error occures because of limited instructions of the architechture, but the register is expicit read AND write capable.

    The register is read/write but only by these particular opcodes.

    Helmut Rahn said:

    spru078f tells the following: "To identify pending interrupts, use the PUSH IFR instruction and then test the
    value on the stack. Use the OR IFR instruction to set IFR bits and use the AND
    IFR instruction to manually clear pending interrupts. All pending interrupts are
    cleared with the AND IFR #0 instruction or by a hardware reset."

    Do i have to implement the access to this register in assembler? Writing to IFR is possible just as well as reading and writing to IER.

    Correct - but please keep in mind that an interrupt could come in just after you push IFR to the stack and the value there would not reflect this.

    Regards,

    -Lori