Tool/software:
I'm using #pragma SET_DATA_SECTION(".fram_vars") to declare variables in FRAM. However, I am not able to modify such variables in real time. I add a dummie code to demonstrate. The array "w2" gets some initial values, but then I want to modify these values.
#pragma SET_DATA_SECTION(".fram_vars")
volatile unsigned char w2[10][2]={0};
#pragma SET_DATA_SECTION()
// Función para inicializar el arreglo con valores específicos
void init_array()
{
unsigned char w2_init[10][2]={
{15, 103},
{137, 154},
{146, 152},
{217, 70},
{114, 251},
{6, 6},
{71, 27},
{122, 109},
{41, 220},
{237, 232}};
for(int i=0;i<10;i++)
{
for(int j=0;j<2;j++)
{
w2[i][j] = w2_init[i][j];
}
}
}
void GPIO_init(void)
{
// Configure GPIO
P1OUT = 0;
P1DIR = 0xFF;
P2OUT = 0;
P2DIR = 0xFF;
P3OUT = 0;
P3DIR = 0xFF;
P4OUT = 0;
P4DIR = 0xFF;
PJOUT = 0;
PJDIR = 0xFFFF;
//PM5CTL0 |= LOCKLPM5; // Disable the GPIO power-on default high-impedance mode
PM5CTL0 &= ~LOCKLPM5; // to activate previously configured port settings
CSCTL0_H = CSKEY >> 8; // Unlock CS registers
CSCTL1 |= DCORSEL;
CSCTL1 |= DCOFSEL_4; // Set DCO to 16MHz if DCORSEL=1
//CSCTL1 |= DCOFSEL_6; // Set DCO to 8MHz if DCORSEL=0,
/*CSCTL2 = SELA__VLOCLK | SELS__DCOCLK | SELM__DCOCLK; // Set SMCLK = MCLK = DCO
// ACLK = VLOCLK
CSCTL3 = DIVA__1 | DIVS__1 | DIVM__1; // set all dividers
CSCTL0_H = 0; */ // Lock CS registers
FRCTL0 = FRCTLPW | NACCESS_1; // Cambia el valor NACCESS_x para agregar la cantidad correcta de estados de espera
}
int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer
GPIO_init();
init_array();
volatile unsigned char dummie=0;
volatile unsigned char d=0;
dummie = w2[3][1];
for(int i=0;i<10;i++)
{
for(int j=0;j<2;j++)
{
dummie=w2[i][j];
w2[i][j]=92;
d=w2[i][j];
}
}
return 0;
}