Access FMT Registers

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Access FMT Registers

420 Views
yipingzhu
Contributor I

Hello,

I create a shall command to display the FMT register values:

  

...................
uint32_t reg;
FTM_MemMapPtr ftm = FTM0_BASE_PTR;

reg = ftm->SC;
printf ("\nSC: %08X \n", reg);
reg = ftm->MODE;
printf ("\nMODE: %08X \n", reg);
reg = ftm->MOD;
printf ("\nMOD: %08X \n", reg);
reg = ftm->CONTROLS[1].CnV;
printf ("\nC1V: %08X \n", reg);
reg = ftm->CONTROLS[1].CnSC;
printf ("\nC1SC: %08X \n", reg);
ftm2->MOD = 290;
printf ("\nMOD: %08X \n", reg);
reg = ftm->MOD;
printf ("\nMOD: %08X \n", reg);

...........................................

But the code will crash when read the first register.

Does the MQX use the MPU to protect the memory access, so cause the OS crashes? How can I access the device registers. I am using the MQX4.2 and run the example in a TWR-K60D100 system.

0 Kudos
2 Replies

347 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Yiping:

Usually an error during write to or read from peripheral register is caused when you try to read/write register while peripheral is disabled with clock gated.

You need to enable peripheral. Check that you can read and write registers via debugger.

If debugger is able to read write to peripheral then it can be read/written from an MQX task as well

Hope it helps

Regards

Daniel

0 Kudos

347 Views
yipingzhu
Contributor I

Great, it works. Ha, so simple.

Many thanks

0 Kudos