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.

CCS/TMS570LC4357: Code working in one board but not in other boards

Part Number: TMS570LC4357
Other Parts Discussed in Thread: HALCOGEN

Tool/software: Code Composer Studio

Hi,

I have been testing in a Hercules board that we bought in August 2019, the micro-controller number is YFB-78AVN2W. I also have other boards bought in January 2020 (micro-controller numbers: YFB-74EPN5W and YFB - 7ACE7XW ). The program is working good in the first board, but when I load the same code to the new boards, the HET timer won't work (as far as I can see - not sure of other functionality). I don't know if the fact that they were bought in different dates can influence in the way they see the code, but I cannot think on anything else.

Do you have an idea how this is possible? or is it something that I could do/test on the new boards?

Thanks in advance for your help.

  • Hello,

    Can you provide more details about "HET timer won't work"? Is the code running to main()? Can you please check the ESM status registers if any error occurs? Did the code get abort (data abort, prefetch aboard, etc)?

  • Hi ,

    The code is running to main() and executing the first part until the part that it wait for the timer. The first part of the program is initialization of drivers and then I wait for a second (using the HET timer) before continue with the program. when loading the other boards the program will stay at the while waiting for the initialization timer to count and won't go any further.

    First part of Main

    int main(void)
    {
    /* USER CODE BEGIN (3) */

    /* Initialize drivers */
    rtiInit();
    ecapInit();
    hetInit();
    gioInit();

    //give a value to the counter
    ecapSetCounter(ecapREG1, 0xFB6A3F30); 

    _enable_interrupt_();

    //timer for initialization
    while (!initTimer)
    {}

    HET interrupt

    void hetNotification(hetBASE_t *het, uint32 offset)
    {
    if (offset == 1 )
    {
    //timer for initialization
    if (initTimer == 0)
    {
    countInit ++;
    }
    if (countInit == 20)
    {
    countInit = 0;
    initTimer = 1;
    }

    }

    The EMS1 register is showing as follows, the rest is 0:

    The code didn't abort, it just stayed waiting in the while for initTimer to change.

    Thanks

  • In your N2HET code, do you enable the interrupt for the 1st instruction? Is the notification function called in het ISR (for example het1HighLevelInterrupt())?

    You can add a break point in hetNotification() to check if the code run into this function.

  • Yes, the interrupt for the 1st instruction is enabled, as I said the program works in one of the boards.

    I have added a break point in hetNotification() and the code doesn't run into this function.

    I also added a break point in het1HighLevelInterrupt() and the code is not entering here.

  • Hello,

    When the interrupt condition in an instruction is true and the interrupt enable bit of that instruction is set, an interrupt flag is then set in the N2HET Interrupt Flag Register (HETFLG). The flag in the N2HET Interrupt Flag Register (HETFLG) is set even if the corresponding bit in the N2HET Interrupt Enable Set Register (HETINTENAS) is 0.

    To generate an interrupt, the corresponding bit in the N2HET Interrupt Enable Set Register (HETINTENAS) must be 1. If any interrupt happens, the corresponding bit in HETOFF1 or HETOFF2 should be set.

    I don't know why the code works on another board. For on-working board, please check HETFLG, HETOFFx registers.

    Can you run the LED blinky example on your no-working board?

  • Hi QJ Wang,

    In this program where the Het timer only works in one board, I was loading the .c and .h files in halcogen as you see in the picture (I found this way in this blog https://www.element14.com/community/community/applications/industrial-automation-space/blog/2017/06/10/stepper-motor-control-with-hercules-high-end-timer-part-7-het-assembly-language-test ).

    In the board that works, this will generate the interruption and it will set the bit in offset1, making the code in hetNotification to run. when I loaded this program in other boards I wouldn't see offset1 nor offset2 change from 0x00000000 with the same program that worked well in the first board.

    Now I have tried doing it the way you wrote in other of my questions, copying the the content of .c to het.c and changing  (void)memcpy((void *)hetRAM1, (const void *)het1PROGRAM, sizeof(het1PROGRAM));    to:   (void)memcpy((void *)hetRAM1, (const void *)HET_INIT0_PST, sizeof(HET_INIT0_PST));  

    then this will set the bit in offset2 and I changed in het.c that the het1LowLevelInterrupt() will call  the hetNotification. this way It seems to work in 2 boards, I need to test the rest, though the offset is not generated correctly (I will reply to you in my other question).

    So I guess the problem her it's with the first way I used to load the .c an .h files. but then this is an easier way to do it and yet why doesn't work correctly in other boards?

  • Hello,

    If the "enable advanced config mode" is checked (you did), the hetInit() shoud be updated to copy HET_INIT0_PST defined in Timer.c to N2HET RAM. 

  • yes, I also checked that Timer.c is copied to NHET RAM starting at: 0xFF460000 and it's there.

    Regards,

    J

  • But you said it works (INT vector is set) after you change the instruction in hetInit() manually to copy the time.c to NHET ram manually. 

  • It worked in the first board, not in the other boards.

    In any case I'm doing it the other way (as I explained in previous reply)  and it works in different boards.

  • Hello,

    Does the code on other boards when you copy the code to NHET RAM manually? Does the PWM code generated through HALCoGen work on all your boards?