Jump to content

Recommended Posts

Hello there:

I have the following problem, I'm using a pic18LF6722 rev 0x00, and as the errata said I'm having problem when returning from interrupts, the solution they propose is to save again the values of status, bsr, wreg on the shadow regs, to do that in c it would be the following:

void interrupt_branch( void )
{
asm pop
whatever ...
...

return;
}

void interrupt(void)
{
asm	call interrupt_branch,1
return;
}

with the call I save the real values on the shadow regs, and pop the return addrr,

the problem is when I compile this it adds a lot of code:

27C0  CFEAF001	  MOVFF FSR0H,  Int1Context
27C4  CFE9F002	  MOVFF FSR0L,  Int1Context+D'1'
27C8  CFF4F003	  MOVFF PRODH,  Int1Context+D'2'
27CC  CFF3F004	  MOVFF PRODL,  Int1Context+D'3'

then the actual call

27D4  C004FFF3	  MOVFF Int1Context+D'3',  PRODL
27D8  C003FFF4	  MOVFF Int1Context+D'2',  PRODH
27DC  C002FFE9	  MOVFF Int1Context+D'1',  FSR0L
27E0  C001FFEA	  MOVFF Int1Context,  FSR0H

before RETFIE FAST

 

The problem is that I'm using 2 UARTs having heavy communication and with all this jumps and data saves it gets corrupted (both Overrun Error bit sets)

If I remove the call and just add the interrupt I work flawless until the interrupt occurs during a two-cycle instruction that modifies those regs, especially wreg wich sometimes has cause to enter a section of code that should't have.

The other thing I have done it to use the low priority interrupt to handle this, but then again it began to cause problem with NOVO

What can I do about this?

Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...