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.
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