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.

LAUNCHXL-F280049C: LAUNCHXL-F280049C : need help to combine TX and RX solution with PLC example code

Part Number: LAUNCHXL-F280049C
Other Parts Discussed in Thread: AFE031, C2000WARE

Hi,

I am trying to combine the boostxl_afe031_f28004x_dacmode and the boostxl_afe031_f28004x_rx into one project. To do it, i tried to launch the dacmode and the rx independently and then modify the ePWM.

I have been able to get the TX solution working with ePWM1/2 same for the RX. But when i tried to modify ePWM1/2 to 3/4 i had nothing. In fact, change ePWM 1 to 3 work but when i want to shift ePWM 2 to 4 i get nothing. 

Do you have any idea on how i can debug it ?

Thanks,

Abed

  • Hi,

    I have found the solution, it was this line that caused the bug : 

    PieCtrlRegs.PIEIER3.bit.INTx2 = 1; that i changed into : PieCtrlRegs.PIEIER3.bit.INTx4 = 1;

    But i have another question :

    I want to integrate SMBus into this project. Do you have an example or some advice to integrate RX - TX - and SMBus. into one project.

    Thanks,

    Abed

  • Hi Abed,

    Glad to hear you resolved your initial issue.

    Do you have an example or some advice to integrate RX - TX - and SMBus. into one project.

    No specific advice for combining the two. I'll check if we have any SMBUS references to provide.

    Best,

    Kevin

  • Hi Abed,

    I don't think we have anything specific for SMBUS, however PMBUS is an extension of SMBUS. Also SMBUS is similar to I2C, but with more signals and SW handling.

    We have software support and examples for both PMBUS and I2C within C2000WARE.

    • PMBUS: C:\ti\c2000\C2000Ware_3_04_00_00\libraries\communications\PMBus\c28
      • It supports only slave operations and is developed as per PMBus spec v1.2.

    • I2C: C:\ti\c2000\C2000Ware_3_04_00_00\driverlib\f28004x\examples\i2c

    Best,

    Kevin

  • Hi Kevin,

    Changing EPWm 1/2 to 3/4 in the dacmode code work but i have some trouble to include RX and TX into one project.

    I have some questions about the initialisation and switching between RX to TX or TX to RX. 

    First one :

    When i initialise my EPwm 1,2 for RX and 3,4 for TX is it correct to do this : 

        //TX and RX EPwm settings
        EALLOW;
        InputXbarRegs.INPUT5SELECT = 500; // Setting to a GPIO number above what exists on device, to avoid interference.
        EPwm1Regs.TBCTL.bit.PHSEN = 1;
        EPwm2Regs.TBCTL.bit.PHSEN = 1;
        EPwm3Regs.TBCTL.bit.PHSEN = 1;
        EPwm4Regs.TBCTL.bit.PHSEN = 1;
        EPwm1Regs.TBCTL.bit.SYNCOSEL = 0;
        EPwm3Regs.TBCTL.bit.SYNCOSEL = 0;
        CpuSysRegs.PCLKCR0.bit.TBCLKSYNC = 1; // Sync EPwms
        EPwm1Regs.TBCTL.bit.SWFSYNC = 1; // Sync PWM1 and PWM2 clocks
        EPwm3Regs.TBCTL.bit.SWFSYNC = 1; // Sync PWM3 and PWM4 clocks
        EDIS;

    or should i do the initialisation independently like this :

        //RX
        EALLOW;
        InputXbarRegs.INPUT5SELECT = 500; // Setting to a GPIO number above what exists on device, to avoid interference.
        EPwm1Regs.TBCTL.bit.PHSEN = 1;
        EPwm2Regs.TBCTL.bit.PHSEN = 1;
        EPwm1Regs.TBCTL.bit.SYNCOSEL = 0;
        CpuSysRegs.PCLKCR0.bit.TBCLKSYNC = 1; // Sync EPwms
        EPwm1Regs.TBCTL.bit.SWFSYNC = 1; // Sync PWM1 and PWM2 clocks
        EDIS;
        
        //TX
        EALLOW;
        // Setting to a GPIO number above what exists on device, to avoid interference.
        InputXbarRegs.INPUT5SELECT = 500;
        EPwm3Regs.TBCTL.bit.PHSEN = 1;
        EPwm4Regs.TBCTL.bit.PHSEN = 1;
        EPwm3Regs.TBCTL.bit.SYNCOSEL = 0;
        CpuSysRegs.PCLKCR0.bit.TBCLKSYNC = 1;
        EPwm3Regs.TBCTL.bit.SWFSYNC = 1; // Sync PWM3 and PWM4 clocks
        EDIS;
    

    Second one :

    Before I enter in my while(1) , i initialise my AFE and configure it to be in RX. Furthermore,i use pwm_enable(0) to disable EPwm 3/4.

    After receiving 3 message i'm trying to switch to TX mode. 

    To switch from RX to TX i do : 

        //
        // Disable EPwm 1/2
        //
        Stop_Receiving();
        
        
        //
        // Disable RX mode
        //
        HAL_afe031_rxDisable();
    
        //
        // Enable AFE DAC
        //
        HAL_afe031_dacEnable();
    
        //
        // Enable AFE TX mode
        //
        HAL_afe031_txDACEnable();
    
        //
        // NOTE: Enable INT output/flags after initializing DAC/PA.
        //
        HAL_afe031_cfgInt();
        
        EPwm4Regs.ETCLR.bit.INT = 1;
        EPwm4Regs.ETSEL.bit.INTEN = 1;
        //
        // Activate EPwm 3/4
        //
        pwm_enable(1);

    and after that i try to transmit a word.

    I tried to use the debug mode and it seems that my ISR are working  but i have nothing out of my DAC. 

    Please can you explain me what is the issue and how to fix it ?

    Regards,

  • Hi Abed,

    It should be OK to configure the ePWMs all together like you've shown. Separating the individual PWM module configurations may provide better code readability however.

    I tried to use the debug mode and it seems that my ISR are working  but i have nothing out of my DAC. 

    To check, both ISRs for TX are being entered OK? Maybe the AFE DAC config needs to math the below sequence exactly:

        //
        // Turn on AFE DAC transmit Enable
        //
        HAL_afe031_txDACEnable();
    
        //
        // NOTE: Enable INT output/flags after initializing DAC/PA.
        //
        HAL_afe031_cfgInt();
    
        //
        // Enable the DAC on the AFE, and set GPIO7 HIGH.
        // (When GPIO7 is high, the device enters DAC Mode)
        //
        HAL_afe031_dacEnable();

    Best,

    Kevin

  • Hi Kevin,

    It seems that your sequence work ! 

    About the PMBus example, do you have any application report to understand every function ?

    Regards,

    Abed

  • Hi Abed,

    Great to hear! There's a PMBUS user's guide in C2000ware directory below:

    C:\ti\c2000\C2000Ware_3_04_00_00\libraries\communications\PMBus\c28\docs

    Best,

    Kevin

  • Hi Kevin,

    I tried to use the PMBus master example. In my case i just wanted to read a value from my BQ that communicate with SMBus (V1.1). And it seems that your PMBus project work with the SMBus ! I was able to retrieve data from my BQ. 

    I have modified the sequence in the pmbus_master_test.c  to this sequence :

    void (*initTestList[NTESTS])(PMBus_TestHandle) =
    {
    
            PMBusMaster_initReadWordTest,
    
    
    };
    
    void (*runTestList[NTESTS])(PMBus_TestHandle) =
    {
    
            PMBusMaster_runReadWordTest,
    
    };

    This is what i have with a tracker :

    So the code and the sequence work but i don't know where the data is stocked and I need to retrieve this value to switch on a LED (for example).

    Can you tell me where the data is stocked ? 

    Regards,

    Abed

  • Hi Kevin,

    I have found it. pmbusMasterBuffer[0] and pmbusMasterBuffer[1]

    My bad !

    Regards,

    Abed

  • Hi Abed,

    Good to hear about the progress and glad you found the data buffer on your own.

    Best,

    Kevin

  • Hi Kevin,

    Currently, everything seems to work as i want (PLC and PMBus) but i just modified existing projects (f280049x_pmbus_master_example and boostxl_afe031_f28004x_rx/dacmode). I want to create my own project that will contain the modified code of each project. But it seems that i have some difficulties to integrate every library : driverlib.lib f28004x_pmbus_communications_stack.lib fsk_corr_detect.lib ... into one project. 

    Can you tell me how to do it ? And if i have some conditions to respect when i create my project ?

    Regards,

    Abed

  • Hi Abed,

    Combining the two projects will be a little challenging since one uses C2000 driverLib files (PMBUS) and the other uses bit-field headers (boostxl_afe031). They're two different software structures for c2000 devices, however you should be able to combine them into one project I believe.

    It might be easier to start with either of the working PMBUS or boostxl_afe031 projects and pull the other code/library content into it.

    You'll need to copy the .lib files into the project and then resolve any include/source (.h/.c) discrepancies. I'll check with a SW expert on the team for comments as well.

    Best,

    Kevin

  • Hi Kevin,

    I modified some part of the project (boostxl_afe031_f280049x_dacmode) to move from COFF to ELF : 

    28004x_FLASH_afe031_lnk.cmd

    f28004x_usdelay.asm

    And change the rts2800_fpu32.lib from the project properties -> build -> c2000 linker -> file search path to rts2800_fpu32_eabi.lib

    I tried to follow C2000 Migration from COFF to EABI and some thread found in this forum.

    Moreover i have expand the .cinit flash sector because i hadn't enough memory for my global variables

    I don't know if I did something great because it's far beyond my knowledge.

    However it work BUT only the fusion of f28004x_pmbus_master_example and boostxl_afe031_f280049x_dacmode. I haven't succeed to merge f28004x_pmbus_master_example and boostxl_afe031_f28004x_rx BECAUSE of the fsk_corr_detect.lib


    warning #10373-D: library "../fsk_corr_detect.lib" contains TI-COFF object files which are incompatible with the ELF output file.  Ensure you are using the proper library.
    warning #10373-D: library "../fsk_corr_detect.lib" contains TI-COFF object files which are incompatible with the ELF output file.  Ensure you are using the proper library.
     
     undefined                       first referenced                    
      symbol                             in file                         
     ---------                       ----------------                    
     FSK_CORR_DETECTOR_INIT          ./boostxl_afe031_f28004x_rx_main.obj
     FSK_CORR_DETECTOR_OverSampl_RUN ./boostxl_afe031_f28004x_rx_main.obj
     FSK_CORR_DETECTOR_RUN           ./boostxl_afe031_f28004x_rx_main.obj
     Packetize                       ./boostxl_afe031_f28004x_rx_main.obj

    The problem is : i need the fusion of PLC (RX and TX together) with SMBus. 

    Can you send me the fsk library modified in ELF format please ?

    Best regards,

    Abed

  • Hi Abed,

    The topic of converting the fsk_corr_detect.lib from COFF to EABI is discussed thoroughly in this other E2E post here: https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/990015/tms320f280025c-tms320f280025c/3743918#3743918

    I believe the library file below was made to work OK from that discussion.

    3582.fsk_corr_detect_lib_eabi.lib

    Best,

    Kevin

  • Hi Kevin,

    Sorry to answer this late, i had to do some test to validate your library and it seems to work.

    I have questions about PLC protocol :

    Currently i'm using FSK modulation with CENELEC B,C,D on the AFE031. Do you have a PEC function to ensure that the data is received correctly.

    Moreover i want to increase the BPS do you have an application note that explain how to do it ?

    Regards,

    Abed

  • Hi Abed,

    Sorry to answer this late, i had to do some test to validate your library and it seems to work.

    That's good to hear.

    Currently i'm using FSK modulation with CENELEC B,C,D on the AFE031. Do you have a PEC function to ensure that the data is received correctly.

    Sorry, not sure what a PEC function is exactly. Can you elaborate on what it is exactly?

    Moreover i want to increase the BPS do you have an application note that explain how to do it ?

    The corresponding app note for the solution is below, however it doesn't discuss how to increase the BPS.

    https://www.ti.com/lit/sprac94

    What BPS are you trying to achieve? Do you plan to use the same mark/space carrier frequencies? You'll need to change the ISR frequencies and some other configurations on the receiver side to achieve higher bit speeds.

    Best,

    Kevin

  • Hi Kevin,

    About PEC : 

    PEC is for Packet Error Checking, optionally implemented on most of the communication to ensure that the data is received correctly. You have this in your PMBUS Communications Stack library and i wanted to know if you have this same function for your PLC Library. This is generally a CRC-8 algorithm based on performing XOR operations.

    About BPS : 

    Currently the time of 1 bit is 5.12 ms. Let's say that i want to go ten time faster ? What i need to change to do it ? And what is the maximum speed i can reach ? I also want to know if the quiet time (TQ) of 900 ms is necessary as you can see on my screen : 

    Regards,

    Abed

  • Hi Abed,

    The boostxl_afe031 software solutions do not have PEC functionality like you mention implemented. It's designed to follow a specific FSK protocol with specific code words, discussed further in the SRPAC94 application note.

    Currently the time of 1 bit is 5.12 ms. Let's say that i want to go ten time faster ? What i need to change to do it ?

    Please see section 5.2 "Receiver Software Implementation" for details on the software specifics. You will need to make changes to the struct below. Also the ISR frequencies for ADC sampling and bit decisions will need to be increased to match your specific BPS.

    FSK_CORR_DETECTORFSK_struct1;// FSK structure

    Best,

    Kevin