We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I have recently changed my interrupt routines to use the 'using RB_LEVELx' format. This seems to have caused a problem which crashes the I2C module. I have tracked the source to a line of code executed in the EOP interrupt routine. I use the ADC with PEC and at the end of each full conversion cycle the PEC control register needs to be reloaded for the next cycle. Its that line of code which seems to crash the I2C module!
As i say this only became apparent after all interrupts where modified to use reg banks. If i comment out the PEC reload code the problem is solved!
Has anyone had any experience with PEC problems or anything that may help.
Hi, i wouldnt say i quite found the root of the problem but i increased the I2C data interrupt to 1 higher than the ADC interrupt and that stopped it crashing.
Also if i removed all the 'using REGBANKx' from all interrupts that helped too.
Its all very strange, if anyone else has had problems using reg banks please let us know.
Thanks,
if you have correctly implemented IIC (NOTE: not SMbus, which otherwise is identical) the IIC will wait for years if required.
Erik
if you have correctly implemented IIC
The code for I2C was generated by DaVE Code genterator V2.8 and worked fine before using regbanks. But it is the actual module of the XC161 that stops responding, not the code.
If anyone has any better I2C routines / library for the XC161 please let me know if they would share them.