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.

TMS320F28379D: How to unify the firmware for both CPU1 and CPU2

Part Number: TMS320F28379D


Hi Experts,

Customer plans to use the same firmware code for both CPU1 and CPU2, and they would like to change peripheral configuration as follows. Therefore, customer would like to know how CPUx itself is able to know if it is CPU1 or CPU2. I mean, is there any useful flags/parameters for this ?

Can I have your Expert’s advice/comments on this, please?

If( “This firmware is running on CPU1” ){

InitGpio1();                                     // Initialize the shared GPIO pins (FILE: Gpio.c)

    InitAdca1();                                    // Initialize the ADC-A (FILE: Adc.c)

    InitEPwm1();                                  // Initialize the DAC-B (File: Dac.c)

    InitDacb1();                                    // Initialize the EPwm (FILE: EPwm.c)

}

Else{

InitGpio2();                                    // Initialize the shared GPIO pins (FILE: Gpio.c)

    InitAdca2();                                    // Initialize the ADC-A (FILE: Adc.c)

    InitEPwm2();                                  // Initialize the DAC-B (File: Dac.c)

    InitDacb2();                                    // Initialize the EPwm (FILE: EPwm.c)

}

Best regards,

Miyazaki

 

  • Miyazaki,

    you can use CPU1/CPU2 predefined symbol to make compile-time You can use. something like below.

    #ifdef CPU1
        InitGpio1();                                     // Initialize the shared GPIO pins (FILE: Gpio.c)
    
        InitAdca1();                                    // Initialize the ADC-A (FILE: Adc.c)
    
        InitEPwm1();                                  // Initialize the DAC-B (File: Dac.c)
    
        InitDacb1();                                    // Initialize the EPwm (FILE: EPwm.c)
    
    #elif defined(CPU2)
    
        InitGpio2();                                    // Initialize the shared GPIO pins (FILE: Gpio.c)
    
        InitAdca2();                                    // Initialize the ADC-A (FILE: Adc.c)
    
        InitEPwm2();                                  // Initialize the DAC-B (File: Dac.c)
    
        InitDacb2();                                    // Initialize the EPwm (FILE: EPwm.c)
    
    #endif

  • Hi Santosh,

    Thanks for your clarification. That's simple and makes sense. I'll share this with our customer.

    Best regards,

    Miyazaki