Other Parts Discussed in Thread: MSP430G2333
Hello
I´m facing some problems with unexpected interrupts in debug mode.
I´m using MSP430G2333 and IAR 5.50.1
When I compile and burn the software in DEBUG mode i get the issue. I can´t get the same problem in RELEASE mode, however i don´t know if the issue still occurs or i only didn´t get that.
The issue in debug mode is that MSP430 is entering in my trap interrupt handler and didn´t return to any location.
Checking Erratasheet MSP430G2333 slaz427b.pdf pag 7 usci 29.
I found:
#######################################################################
USCI29 USCI Module
Function Timing of USCI I2C interrupts may result in call to a reserved ISR location
Description When certain USCI I2C interrupt flags (IFG) are set and an automatic flag-clearing event
on the I2C bus occurs, the device makes a call to the TRAPINT interrupt vector. This will
only happen if the IFG is cleared within a critical time window (~6 CPU clock cycles)
after a USCI interrupt request occurs and before the interrupt servicing is initiated. The
affected interrupts are UCBxTXIFG, UCSTPIFG, UCSTTIFG and UCNACKIFG.
The automatic flag-clearing scenarios are described in the following situations:
(1) A pending UCBxTXIFG interrupt request is cleared on the falling SCL clock edge
following a NACK.
(2) A pending UCSTPIFG, UCSTTIFG, or UCNACKIFG interrupt request is cleared by a
following Start condition.
Workaround (1) Poll the affected flags instead of enabling the interrupts.
(2) Define an ISR for the interrupt vector TRAPINT. If the failure condition occurs; a call
to the TRAPINT ISR is made. After the interrupt is serviced, the device returns to the
application code and continues execution.
Include the following ISR definition in the application code.
#pragma vector= TRAPINT_VECTOR
__interrupt void TRAPINT_ISR(void)
{
__no_operation();
}
For IDE versions earlier than IAR V4.22 and CCS V4.2 in addition to the above code;
include the ISR definition in the device header file.
In IAR Embedded Workbench include the following line in the device header file
MSP430x23x0.h.
/************************************************************
* Interrupt Vectors (offset from 0xFFE0)
************************************************************/
#define TRAPINT_VECTOR (0* 2u) /*INCLUDE THIS LINE IN .h FILE*/
#define PORT1_VECTOR (2 * 2u) /* 0xFFE4 Port 1 */
In Code Composer Essentials/Studio include the following line in the device header file
MSP430x23x0.h.
/************************************************************
* Interrupt Vectors (offset from 0xFFE0)
************************************************************/
#define TRAPINT_VECTOR (0 * 1u) /*INCLUDE THIS LINE IN .h FILE*/
#define PORT1_VECTOR (2 * 1u) /* 0xFFE4 Port 1 */
#######################################################################
So I suspect that it´s related to this i2c issue.
I have tested 3 situations:
1 - Running at debug mode with J-TAG
2 - Running at debug mode without any J-TAG (just compiled and burned msp in debug mode)
3 - Running at Release mode without J-TAG
Results:
1 - MSP430 halts (lock). Than I Break the software and it´s stopped on TRAPINT_VECTOR. Why it´s stopped there? If I click on GO , MSP430 continues to run normally
2 - MSP430 halts (lock) and only returns to run if i remove 3v3 power supply
3 - I can´t get the issue, maybe because i haven´t tested it too much, however I think it will occur to.
Accordantly to USCI29 bug
I suppose that with the trap handler my software needs to continue even if the traps occur.
I also tested with CCS5.3.0 and get the same problem
So my question is: Is it happening because i´m compiling in debug mode? Will it happens also in RELEASE mode?!
Thanks in advance