View previous topic :: View next topic |
Author |
Message |
bdeb
Joined: 05 Nov 2010 Posts: 42 Location: Sweden
|
18F16Q41 IOC error |
Posted: Sun Mar 26, 2023 9:36 am |
|
|
uP=18F16Q41, CCS=5.115 + 5.107, IDE=MPLAB 6.0, OS=Win10
Dear code gods,
For once I may be offering a solved problem!
After *several* nights tracking nasty problems with interrrupt-from-sleep from IOC, this is what I found:
Using disable_interrupts(any_ioc_pin) will brutally clear PIE0.7 i.e. IOCIE!
Apart from that, the (frugally documented) IOC functions work excellent!
enable_interrupts(INT_IOC_C3_H2L) will set bit 3 in IOCCN.
enable_interrupts(INT_IOC_C4_H2L) will set bit 4 in IOCCN without clobbering bit 3, etc.
(enable_interrupts(INT_IOC_C4) will enable both edges)
Furthermore interrupt_active(INT_IOC_C3_H2L) will test IOCCF bit 3.
Happy if someone could verify this, so I'm not misleading.
All the best:
/BdeB |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19540
|
|
Posted: Mon Mar 27, 2023 12:59 am |
|
|
Well done.
I think the lack of documentation, is the big problem with these.
Historically the interrupt enable/disables were simple. Just physical interrupts.
Then they 'evolved', with the addition of the abilities to control/detect the
extra bits for IOC. Unfortunately this evolution has never really been
documented. There have been some threads here as people found what
could/was being done.
You have given us the best overview so far on these. |
|
|
bdeb
Joined: 05 Nov 2010 Posts: 42 Location: Sweden
|
|
Posted: Mon Mar 27, 2023 7:16 am |
|
|
Dear Ttelmah, thank you for your kind words!
I'll better report this directly to CCS, right?
All the best:
/BdeB |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19540
|
|
Posted: Mon Mar 27, 2023 8:42 am |
|
|
It's not a fault, just a lack of documentation. The disable just disables the
whole interrupt involved.
There are lot of areas where their documentation has gone 'backwards'.
For example, the 'readme' with each compiler is no longer updated.
This is another example.
Perhaps they do need a 'kick' to bring the documentation up to date... |
|
|
|