I am running into an issue trying to access the SFRIFG1 register using a HAL approach. The header file looks like the following:
#ifndef DRIVERS_INC_SFR_H_
#define DRIVERS_INC_SFR_H_
#include <msp430.h>
#include <stdint.h>
typedef struct
{
volatile uint16_t SFRIE; /*SFR interrupt enable register Offset 0x00 */
volatile uint16_t SFRIFG; /*SFR interrupt flag register Offset 0x02 */
}SFR_RegDef_t;
#define SFR (SFR_RegDef_t*)SFR_BASE
typedef struct
{
SFR_RegDef_t *pSFR; /*holds base address of special function register */
}SFR_Handle_t;
#endif /* DRIVERS_INC_SFR_H_ */
I use this technique on other drivers as well....They all seem to work fine. For instance when I look at the pointer all working ones point at the correct base address of the register set (ie TB1 points to 0x3C0) as expected. Here however when I try to access the SFR my debugger points to 0x6904??? This should be 0x0100. Any thoughts on why this would do this?
My code that is NOT working:
do
{
pECSHandle->pECSx->CSCTL[7] &= ~(XT1OFFG | DCOFFG);
(clock_SFR.pSFR->SFRIFG) &= ~OFIFG;
} while ((clock_SFR.pSFR->SFRIFG) & OFIFG);
If I replace (clock_SFR.pSFR->SFRIFG) with SFRIFG1 as in the example Resource Explorer code all is fine.
Thanks