Hardware: Tiva-C evaluation kit EK-TM4C123GXL
I am testing two modules in my application. One of them uses a timer and the I2C, the other uses another timer. The two modules run well when tested separately, but if I run them together, the application crashes and I can not find the reason for this. CCS does not give me any useful information, I do not know how to configure it.
The first module is a real time clock using DS1307. A task reads the IC through I2C every 10 ms. The timing is determined by the timer module, which posts an event to unblock the task.
The second module is a wrapper to a 16x2 LCD display. It uses a timer to set the appropriate timing for the commands sent to the display.
For testing purposes, I create an instance of the RTC module in a task context, wait for 5 seconds, and create the LCD module. In the RTC reading just after LCD instance creation, when the function "I2C_Transfer" is called, the application crashes, giving this:
e: 0x20000fd8.
Task stack size: 0x568.
R0 = 0x00000001 R8 = 0x0000fa94
R1 = 0x00000068 R9 = 0x0000fa84
R2 = 0x000000d0 R10 = 0x0000fa8c
R3 = 0x00004a88 R11 = 0x0000fa90
R4 = 0x20003f60 R12 = 0x00007ec9
R5 = 0x0000f454 SP(R13) = 0x20001488
R6 = 0x00000001 LR(R14) = 0x000049f5
R7 = 0x0000fa88 PC(R15) = 0x000049f6
PSR = 0x21000000
ICSR = 0x00456803
MMFSR = 0x00
BFSR = 0x04
UFSR = 0x0000
HFSR = 0x40000000
DFSR = 0x0000000b
MMAR = 0xe000ed34
BFAR = 0xe000ed38
AFSR = 0x00000000
Terminating execution...
I tried to trace the execution of the task until the crash moment is reached, the call sequence is the following:
I2C_transfer -> I2CTiva_transfer -> I2CTiva_primeTransfer -> I2CMasterSlaveAddrSet
The crash occurs in the following line of code of the file i2c.c:
1140: HWREG(ui32Base + I2C_O_MSA) = (ui8SlaveAddr << 1) | bReceive;
Stepping through assembly, the function "ti_sysbios_family_arm_m3_Hwi_excHandlerAsm__I" is called. I do not know where is the source code for this function, so I could not go any further.
I noticed that if I do not create the timer module in the LCD code, no error occurs.
I spent days trying to fix this, I am going crazy. Is there anything I can do to find out more about this error?
Thanks