This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Register values can not be modified through C Code

Other Parts Discussed in Thread: TMS570LC4357, HALCOGEN

Hi TI,

Here I have an issue which is very new to me.

I am using TMS570LC4357 with free-RTOS (HalCoGen generated code).

And I want to use N2HET and HTU Peripherals too.

So Before StartScheduler() function, I can do modify the value of any HTU related Register, (ex: CPENA, GC etc.,)

But after StartScheduler() fucntion is called, I can not modify any HTU related Register contents through code.

But the notable point here is that I can do modifying the value of any HTU related register through debugger, but not through the c code.

I have attached the sample code with this post which causes the issue.

4377.HETHTURTOS.zip

And the snapshots to explain my issue is below.

I cannot understand why the HTU Registers are not written when the htu1REG->CPENA = 1; is getting executed.

And another note here I want to share is below.

Is this caused by MPU unit configuration? or any other reason?

Please anybody guide me to modify HTU Registers after free-RTOS code starts running.

Thanks in advance.

Regards,

Karthikeyan.k

  • I would suggest to check the following.

    (1) CPU mode. CPU can only modify HTU registers when it is in privilege mode.

    (2) MPU setting for the HTU registers.

    Thanks and regards,

    Zhaohong

  • Hi Zhaohong Zhang,

    Please sir. Could you please elaborate your statement. I can not understand this.

    How to Check CPU mode, how to change it?

    and what I have to see in MPU setting?

    I manually enable MPU region 13 with Base Address 0xFFF7A400 and size as 512kb and permission as PRIV_RW_USER_RW_EXEC, Type is Device Shareable. But that try also didn't work. CPU cannot write those HTU registers even after I make MPU Region to be ReadWrite Accessable in both Privillage mode and user mode. (I did this in HalCoGen R5-MPU-PMU tab).

    Thanks,

    Regards,
    Karthikeyan.K
  • If you take a look at the HTU section in the TRM, you will see that the HTU registers is only writable in privilege mode. MPU setting will not change it. You can check the CPSR register to see if CPU is in the user mode or one of the privileged modes. The definition of CPSR can be found in the Cortex-R4 TRM.

    Thanks and regards,

    Zhaohong
  • Hi Zhaohong,

    Thanks for your response. Yes TMS570LC4357 trm asks to write HTU registers in privileged mode only.
    So I do creating that 10ms task as privileged task using portPRIVILEGE_BIT in xTaskCreate function.
    In this way I make 10ms Task as privileged task. So Now I can overwrite the htu registers.

    So My intention is done.

    But there is another problem sir.
    After I did configuring HTU and N2HET successfully, N2HET Instruction (DJZ) is giving request to HTU Unit, and HTU unit also do transmitting the data to the data field of the DJZ Instruction in the N2HET RAM.
    But N2HET RAM data filed of DJZ Instruction is not getting updated with the new value. It remains zero, even though HTU request from N2HET and HTU Transmission to N2HET RAM is happening.

    I thought here also same access rights issue is there. Please help me in this too.

    In privileged task I can configure HTU and HET registers but HTU cannot update N2HET RAM.

    Thanks in advance.

    Karthikeyan.K
  • Would you please close this thread because you have started another thread with the same question.

    Thanks and regards,

    Zhaohong