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.

TMS570LS3137-EP: Can't read or write to NHET Module - MCU is initialized through Autosar MCAL tool

Part Number: TMS570LS3137-EP
Other Parts Discussed in Thread: HALCOGEN

Hi

I'm wiritng for and issue which displays the exact same symptoms as described here :

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/216485/unable-to-read-write-nhet-section-registers

NHET registers are all 0. I can't write into them with the debugger either.

The init is done through the Autosar MCAL configured in tresos. Init sequence is a typical autosar one  MCU_Init / Port_Init etc ...

We can get pwm out working /and all other IOs working bar the ones mapped to NHET module.

Clock domain config seems all fine.

Could you please help on this as it is a blocking issue for us at the moment ?

Thanks

Regards

Seb

  • Hi Seb,

    We can get pwm out working /and all other IOs working bar the ones mapped to NHET module.

    The PWM is generated using N2HET module, so the N2HET module is working. 

    Have you configured the PIMMUX properly? Which NHET pins do not work? 

  • Hi QJ.

    Thanks for your reply. Yes we configured pin mux correctly, we doubled checked this in the PortModule.

    We can't read any of the digital inputs 0 to 4 mapped to N2HET[1] / [4] /[7] / [8] /[9]

    The NHET module is reading all 0x00000. It cannot be written using the debugger either.

    We can see the MCAL trying to set the port pin direction but registers are staying all 0.

    We checked the clock setup and it looks ok. We compared values for Sys1 / Sys2 / PMM from a project where we can reqad the pins fine that runs under Free RTOS.

    They are the same.

    We cannot find anything into the documentation pointing us to somthing we could double check.

    No leads in the forums for a similar problem either.

    Thanks a lot in advance for your help.

    Regards

    Seb

  • Hi Seb,

    I am not sure where all the N2HET registers are cleared. I am not able to port MCAL modules' configuration to EB Tresos's project, and I will re-install MCAL driver and try again. From the screenshot below, only TCAN4x5x configs are available for selection.

  • Hi

    In Tresos we can configure several modules but not NHET directly.

    We can share the MCAL Config we currently have as well as the projet in private if that is required.

    This issue is currently blocking progress our side. It might be something small we missed. We really appreciate your help.

    Thanks

    Seb

  • Hi

    So we nailed down the problem with the NHET module becoming inactive is when the CLKCNTL is written and in particular when VCLK2R is written.

    Both function systemInit() from halcogned and MCU init are doing the same.

    For system init, it is in mapClocks() function.

    For Mcu_Init(), it in function Mcu_MapClocks() line 2022 called by Mcu_SystemInit1().

    I haven’t tried any other values than 1 for VCLK2R which would equals to having PLL frequency / 2 for VCLK2.

    But writing 0 like here, module stay active. Writing 1, it becomes inactive.

    Our board as a 20MHz crytstal instead of a default 16MHz that would be used on the evaluation board for example

    In Halcogen, when doing a project bare metal. We put the correct oscillator value and adjust PLL1 config and the board behaves ok.

    Not with the MCAL.

    We do not have a way of setting the oscillator frequency. Paramter McuLpoOscFrqCnt offers 2 options OscFrq20 or OscFrq80.

    We chose OscFrq20. That does not seem to be related to the crystal input even though names would suggest so.

    Other parameters are identical as to what we put in halgogen ...

    We might be doing something wrong into the MCAL config.

    Could you please help.

    Thanks

    Seb

  • Hi Seb,

    I don't have a working EB Tresos on my PC. Per the user guide, McuClockReferencePointFrequency is OSC input:

    BTW, the doc is located in ..\Mcu_TI_TMS570LSx\docs

  • Hi QJ

    Thanks for your answer. I've been adding this clock reference point at 20Mhz like described.

    But it does not resolve the issue nor seem to really affect generated code fro the MCAL.

    The only thing that seems working our side it to configure McuVclk2R = 1 instead of the usual 2.

    We are progressing with but it would be good to know where the issue is coming from. We checked by sevral ways the clock of the CPU seems to be OK at 180MHz from PLL1 but we would appreciate if you could review the config.

    and PLL 1 config being matching HALCOGEN Settings.:

    Thanks for your confirmation.

    regards

    Seb

  • Hi QJ

    Thanks for your answer. I've been adding this clock reference point at 20Mhz like described.

    But it does not resolve the issue nor seem to really affect generated code fro the MCAL.

    The only thing that seems working our side it to configure McuVclk2R = 1 instead of the usual 2.

    We are progressing with but it would be good to know where the issue is coming from. We checked by several ways the clock of the CPU seems to be OK at 180MHz from PLL1 but we would appreciate if you could help review the config pointing us to the main mandatory points for clock settings.

    Regards

    Seb.

  • Hi Seb,

    After you port the MCAL driver and EB tresos generated files to your CCS project, you need to call Mcu_Init() to set PLL and enable peripherals. After calling Mcu_Init(), the NHET registers should be programmable.

    Before you use PWM and ICU APIs, the Icu_Het_Init() and pwm_Het_Init() should be called initialize the N2HET module and program the PWM and ICU codes to N2HET RAM.

    The Icu_Het_Init() or pwm_Het_Init() writes 0x30001 to CGR register, and 0x700 to PFR register.

  • Hi QJ

    Thanks for your answer. 

    After you port the MCAL driver and EB tresos generated files to your CCS project, you need to call Mcu_Init() to set PLL and enable peripherals. After calling Mcu_Init(), the NHET registers should be programmable.

    ==> Yes this is exactly what we are doing but after MCU init, the only way we get it working for now is by not dividing the clock input for NHET. If a divider is introduced, the NHET module cannot be programmed using debugger after MCU_Init.

    Maybe settings of PLL are wrong but we have been comparing with Halocgen generated ones and they are same.

    Then further in the code after MCU_Init we use  Icu_Het_Init() and pwm_Het_Init() .

    Again all works fine clock inpout to NHET is not divided.

    Would be great to understand what we are doing wrong.

    Regards

    Seb

  • Hi Seb,

    Have you resolved the N2HET issue?

  • Hi

    No, not as having the clock divider working.

    We are going with the work around were we do not divide the clock frequency feeding NHET module. We have it running at 180MHz and adapted the code accordingly.

    That does the job.

    Regards

    Seb