Access FMT Registers

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Access FMT Registers

1,234件の閲覧回数
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 件の賞賛
返信
2 返答(返信)

1,161件の閲覧回数
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 件の賞賛
返信

1,161件の閲覧回数
yipingzhu
Contributor I

Great, it works. Ha, so simple.

Many thanks

0 件の賞賛
返信