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.

TMDSCNCD28379D: How to configure the CLB properly using sysConfig?

Part Number: TMDSCNCD28379D
Other Parts Discussed in Thread: SYSCONFIG, TMS320F28379D, , C2000WARE

Tool/software:

Hi,

I am trying to use CLB tool to do a very simple logics but it is hard for me. Could you please help me?

I have 5 signals from 5 GPIOs, say GPIO1, GPIO2, GPIO3, GPIO4, GPIO5.and I am trying to use CLB to make them ORed to one GPIO, say GPIO6. From sysConfig, I found 5 items related to CLB but don’t know how they connect each other.

Step1: Input GPIOs configuration under CLB INPUTXBAR INPUT

1.1: Number of CLB INPUTXBAR INPUT = Number of input GPIOs?

Step2: signals configuration under CLBXBAR

2.1: Number OF CLBXBAR = Number of GPIOs?

2.2: Selection of Aux Signal input: one from 8 AUXSIGx, which one should I choose. It looks like it is CLB output shown in the CLB X-BAR Architecture. Here is the name for the signal input. What does this signal connect, one of the input GPIOs in my case? Where to confirm the connections?

Step3: Tile Design under CLB

3.1: what do I need to choose for i0, i1, i2, i3? They should be signals from GPIOs.

3.2: I have 5 signals from 5 GPIOs to be processed. Can I only have 1 CLB since each CLB has three 4-input-LUTs?

LUT0 equation: i0 | i1| i2 | i3 = LUT 0 Output. i0 is from GPIO0, i1 is from GPIO1, i2 is from GPIO2, i3 is from GPIO3.

LUT1 equation: i0 | I1 | i2 = LUT 1 Output. i0 is from GPIO4, i1 is from GPIO5, i2 is from LUT 0 Output.

Step4: Output GPIOs configuration under CLB OUTPUTXBAR

4.1: Number of CLB OUTPUTXBAR = Number of output GPIOs?

4.2: How to confirm that LUT 1 output is connected to the specified output GPIO, say GPIO6 in my case?

Thanks,

Hongmei Wan

  • Hi Hongmei,

    Do you have the correct device selected in SysConfig. On the F28379D device, you don't have access to CLB OUTPUXBAR or CLB INPUTXBAR. 

    The GPIO input must come from INPUTXBAR + CLBXBAR. And the GPIO output will be through the OUTPUTXBAR.

    You can refer to the CLB chapter in the C2000 Academy tutorial, there is specifically a section describing GPIO inputs and GPIO outputs through the CLB, I think this will be very helpful for you.

    You should configure a INPUTXBAR + CLBXBAR combination for each GPIO and route them as Boundary inputs into the CLB module. See below for example to route GPIO0

    Once you input all GPIOs you need, you can then attach a TILE config to the CLB and config LUT0.

    With the a single 4-input LUT, you can only OR 4 GPIOs together at once. So then you will need to use 2 LUTs (LUT0 and LUT1).

    The LUT equations you have provided are correct. Example below

    Note that Boundary input 0 refers to what you have configured as CLB Input 0 above.

    For the output of the CLB, you need to use Output LUT, specifically OUTLUT4 or OUTLUT5 since those are the only ones accessible through the OUTPUTXBAR

    Then finally, you can configure the OUTPUTXBAR. It will be helpful to select the Auto Enable Mux Settings from Source and then in the Source Signals, select the CLB1 OUT4. This is from CLB1 peripheral with output of OUTLUT4 equation

    Regards,

    Peter

  • Hi Peter,

    First thank you for your precious time and detailed explanations which help me a lot. Now I switched to TMS320f28379D. We use TMDSCNCD28379D control card and the settings for CLB are same, right?

    For the CLB chapter in the C2000 Academy tutorial, do you refer to these 4 videos?  https://www.ti.com/video/series/C2000-configurable-logic-block.html?keyMatch=C2000%20Academy%20tutorial%20clb&tisearch=universal_search. Yes, it is helpful.

    I am still confused about the routing because the names are different and I am not sure if I understand it correctly or not. Could you please help me with the following questions?

    1. under INPUTXBAR INPUT: GPIO passed to XBAR_INPUT1

    XBAR_INPUT1,... XBAR_INPUT14. So I can get 14 GPIOs processed, right?

    2. under CLBXBAR: INPUTXBAR1(MUX01) passed to AUXSIG0

    Does INPUTXBAR1(MUX01) refers to XBAR_INPUT1 above in #1?

    XBAR_INPUT1, ...XBAR_INPUT6. If XBAR_INPUTx=INPUTXBARx, then actually only 6 GPIOs can be processed, right?

    3. under CLB: CLB X-BAR AUXSIG0 passed to CLB input 0

    Does CLB X-BAR AUXSIG0 refer to AUXSIG0 above in #2?

    4. under Tile: boundary input x refers to CLB input x. Do I understand you correctly?

    boundary input 0 = CLB input 0, ...boundary input 7 = CLB input 7.

    Thanks,

    Hongmei Wan

  • Hi Hongmei,

    I am referring to this link: https://dev.ti.com/tirex/local?id=source_c2000_advanced_topics_c2000_configurable_logic_block&packageId=C28X-ACADEMY

    1. under INPUTXBAR INPUT: GPIO passed to XBAR_INPUT1

    XBAR_INPUT1,... XBAR_INPUT14. So I can get 14 GPIOs processed, right?

    Yes this is correct, there are 14 INPUTXBAR. Note that these INPUTXBAR are not only for CLB though, they can also be routed to the EPWMXBAR and OUTPUTXBAR, eCAP, and ADC, so keep that in mind when allocating resources.

    Does INPUTXBAR1(MUX01) refers to XBAR_INPUT1 above in #1?

    XBAR_INPUT1, ...XBAR_INPUT6. If XBAR_INPUTx=INPUTXBARx, then actually only 6 GPIOs can be processed, right?

    Yes that is correct. XBAR_INPUT1 is the same and INPUTXBAR1. And up to 6 can be sent to the CLBXBAR/EPWMXBAR/OUTPUTXBAR. The rest are reserved for other peripheral like eCAP.

    Does CLB X-BAR AUXSIG0 refer to AUXSIG0 above in #2?

    This is correct, the AUXSIG0 means the same in both instances.

    boundary input 0 = CLB input 0, ...boundary input 7 = CLB input 7.

    Yes this is correct, the CLB Input number is matched to the Boundary input number

    Regards,

    Peter

  • Hi Peter,

    Thank you very much! You helped me a lot to understand the CLB architecture. I am starting to set it up in our project. And I am trying to use counters to filter some noise before latching the signal.

    The signal here refers to LUT 0 Output (to simplify it, let’s say x). If event of (x=1) happens continuously for 50us (counting to 5000 then reset to 0), then latch the signal x=1, otherwise x=0. I did this in CPLD before and it seems it is hard for me to do using CLB and it seems hard to do it with one counter.

    #1: what is for event trigger, the signal to be processed? see the picture below.

    #2: what is event load value? see the picture below.

    #3: Does this mean the count adding up when the event is triggered? see the picture below.

    4. The outputs of the counter has zero, match 1, match 2, counter value.

    Does this mean if counter=zero, counter output=1; if counter=match1, counter output=1; if counter=match2, counter output=1; if counter=counter value, counter output=1?

    5. Where to check the detailed descriptions of counter and FSM?

    Thanks!

    Hongmei Wan

  • Hi Peter,

    It seems one counter is enough for my case. But I don't know if the counter setting is right or not and I don't know where to find the output y if input x=LUT 2 output. My input x and output y are on the left figure.

    Thanks in advance for your help,

    Have a great weekend,

    Hongmei Wan

  • Hi Hongmei,

    It sounds like you would need at least an FSM and a counter to accomplish your latching logic. For inputs, it may be helpful to include not only the signal itself, but a falling edge detect of the signal. That way when you receive the falling edge, you reset the counter. Since you have 2 conditions for the counter reset, you can choose to use a LUT to OR these 2 signals together. Or if you are not using the Event trigger, you can use the load event feature to load a value of 0, essentially resetting the counter. Your counter enable being set to the LUT 2 Output is correct. The Counter 0 Equals Match 1 should be fed into a FSM, where the FSM is configured for SR latch logic. The Counter 0 Equals Match 1 would be the set signal and you can choose how to configure the reset logic, possibly a LUT combination of your other reset logics.

    Regards,

    Peter

  • Thank you Peter!

    Definitely I will try to do it as you suggested. Could you please help me with the following questions about the counter?

    1.What does the output of ZERO, MATCH1, MATCH2, Counter Value looks like?

    2.Period 2, 4 for the counter number to reset to 0?

    3.What does the event trigger (zero) refer to?

    4.What makes the counter number keep increasing?

    5.If the period 3 on the left is very long, does the counter number overflow if the drawing is right?

    6. Does the counter event action need to be configured to add up or the counter just keeps increasing if the counter is enabled and the direction is given?

    Thanks,

    Hongmei Wan

  • Hi Hongmei,

    What does the output of ZERO, MATCH1, MATCH2, Counter Value looks like?

    The output of these match conditions will be a 1 CLB clock cycle high pulse. It will be high at the time when the match condition is met and low otherwise.

    Period 2, 4 for the counter number to reset to 0?

    If you have the counter reset condition set to Boundary Input 0, then yes, the counter will be reset at the rising edge of the i0 signal, as you have drawn in the diagram

    What does the event trigger (zero) refer to?

    Event trigger is the input signal which will cause the event to occur (load, add, subtract, shift). If it is set to Zero, that means constant low and so the Event trigger feature is not being used.

    What makes the counter number keep increasing?

    The counter will increase when the Enable counter is high and the Direction is high. On each CLB Clock cycle, the counter will look at the enable and direction signals, and will increment if the above conditions are met.

    If the period 3 on the left is very long, does the counter number overflow if the drawing is right?

    Yes if the counter counts past 16-bit maximum integer, then it will overflow. You can reduce the CLB clock speed or use a second counter as a clock divider if you believe the counter may overflow. Or you can add additional reset conditions.

    Does the counter event action need to be configured to add up or the counter just keeps increasing if the counter is enabled and the direction is given?

    The event action does not need to be used for the counter to increment, it is simply based on direction and enable. If you want to count by numbers other than 1 (such as incrementing by 2) then you can use the event action set to ADD and then put 2 in the event load value

    Regards,

    Peter

  • Hi Peter,

    Thanks a lot. Could you please help check my following settings and questions?

    The output of these match conditions will be a 1 CLB clock cycle high pulse. It will be high at the time when the match condition is met and low otherwise.

    So at point A, MATCH1 is only maintain HIGH for one CLB clock cycle and there is 1 CLB clock cycle high pulse at t1, t2, t3, t5, t6 at Zero match. To latch it, we have to use FSM?

    Event trigger is the input signal which will cause the event to occur (load, add, subtract, shift). If it is set to Zero, that means constant low and so the Event trigger feature is not being used.

     Is event trigger active High? Based on my settings, if I use LUT 0 Output as event trigger, the counter is incrementing by 2 when the LUT 0 Output level is high. Is this setting right for it? Is the drawing right?

    Thanks again,

    Hongmei Wan

  • Hi Hongmei,

    So at point A, MATCH1 is only maintain HIGH for one CLB clock cycle and there is 1 CLB clock cycle high pulse at t1, t2, t3, t5, t6 at Zero match. To latch it, we have to use FSM?

    Yes, you need to use FSM simulated as SR latch in order to latch the match signal

    Event trigger is the input signal which will cause the event to occur (load, add, subtract, shift). If it is set to Zero, that means constant low and so the Event trigger feature is not being used.

    Yes the event trigger is only rising edge triggered. So you need to pulse high then low and then high again for the counter to increment by 2. See below for simulation of adding 5 every event

    Regards,
    Peter

  • Hi Peter,

    Thanks a lot! I almost finished my CLB setup with your help and later I plan to do the simulations.

    Then I add the following header files and functions to my main () function. My current project is fully developed and I am trying to add these generated files to my application.

    #include "board.h"
    #include "clb_config.h"
    #include "clb.h"

    Board_init();  //all the hardware setup
    CLB_enableCLB(CLB1_BASE);
    initTILE0(CLB1_BASE); //all the logic setup

    These files are auto-generated. Is it good enough to add these files to the main () to get the logic done? Do I need to move anything else for the application to make it work as expected?

    After adding #include "board.h“, problems appear: expect an identifier and a lot of redefinition of macro like below. How to fix it?

    Thanks,

    Hongmei Wan

  • Hi Hongmei,

    Those look like the correct definitions. Be sure to have the #include statements in the top level outside of the main loop and the Board_init and other function calls should be inside the main loop in the initialization section.

    Do you also have the below include statements?

    #include "driverlib.h"
    #include "device.h"

    If you do have all of these and the code is still not working, it may be an issue with your SysConfig project path. Can you send a screenshot of what is shown in the Project Properties under the SysConfig settings?

    Regards,

    Peter

  • Hi Peter,

    Please check my #include files outside the main and those functions inside the main. SysConfig path is shown below.

    After I comment out these CLB_related files, I got another issue: Cannot find module 'C:\dot_file_libraries\clbDotUtility'. Everything before is good and now I have no idea what to do.

    Thanks,

    Hongmei Wan

  • Hi Hongmei,

    It should only be looking for the dot Utility files when you are using the #include clb.h and clb_config.h. These are used for the diagram generation. 

    It looks like you have quite a few includes. It may be pulling the same file over again and redeclaring the variables. You can start with the includes from lines 18-22 and then slowly add back in the other includes as necessary. To get rid of the error, it looks like the relative path was not found for the variable. Can you go into the project properties and review if there were any Linked Resources which do not point to the correct path. You can also double check the Include Options under the Build > C2000 Compiler settings to verify the path. 

    Regards,

    Peter

  • Hi Peter,

    Any of the following three will cause this issue. The "board.h" already has the include statement of #include "driverlib.h" and #include "device.h". The main.c file has #include "driverlib.h",  #include "device.h", and #include "board.h". It looks like main.c file directly and indirectly has two times of #include "driverlib.h",  #include "device.h". Do I need to have these two include statement in main.c file? Does it hurt anything to use this way?

    //#include "driverlib.h" // a lot of compilation issues after adding this #include
    //#include "device.h"    // a lot of compilation issues after adding this #include
    //#include "board.h"    // a lot of compilation issues after adding this #include

    If I have two files with same macro, for example the error below. Which one should the compiler look for? What can I do? There are too many. 

    ["C:\ti\c2000\C2000Ware_5_04_00_00\driverlib\f2837xd\driverlib\sysctl.h", line 185: warning #48-D: incompatible redefinition of macro "Device_cal" (declared at line 297 of "C:\ReposWindliftDCDC\DSPfirmware_groundDCDC_28379D 2\DSPfirmware_groundDCDC_28379D\cpu01\device_support_linked_files\../device_support_linked_files/F2837xD_Examples.h")]

    #define Device_cal ((void (*)(void))((uintptr_t)0x070282))  in "C: ti\c2000\C2000Ware_5_04_00_00\driverlib\f2837xd\driverlib\sysctl.h"

    #define Device_cal (void   (*)(void))0x070282 in "C:\ReposWindliftDCDC\DSPfirmware_groundDCDC_28379D 2\DSPfirmware_groundDCDC_28379D\cpu01\device_support_linked_files\../device_support_linked_files/F2837xD_Examples.h"

    The relative paths seems right.

    Thanks,

    Hongmei Wan

  • Hi Peter,

    Yesterday I thought the first relative paths are set by default and didn't realize that it shows "none" in the first Fig.1 but I clicked on it the path shows there in Fig.2. I am not sure if this will cause the issues or not.

    How can I fix the issues of the incompatible redefinition of macro? I can't delete one of the files. For example, I can't delete sysctl.h in C2000Ware or F2837xD_Examples.h in device. Or actually I have no choice to use CLB tool because there are some files with conflicting definitions of macro?

    Thanks,

    Hongmei Wan

  • Hi Hongmei,

    Yes that seems like the relative paths did not get set correctly. What you can do is find and link to the paths manually through an absolute path. So you can add the compiler search paths directly by using the green add button. Once you open up the file explorer prompt, you can directly look for the path. For example, for the COM_TI_C2000WARE_INCLUDE_PATH, that is searching for the top level of the C2000Ware SDK so you can look for that path and add to the include paths.

    Regards,

    Peter

  • Hi Peter,

    I am not sure if the path is right or not and the issues stay the same. Could you please specify the exact folder name then I can search for it on my side? 

    SYSCONFIG_TOOL_INCLUDE_PATH: "C:\ti\ccs1281\ccs\utils\sysconfig_1.21.0", no include folder inside sysconfig_1.21.0.

    COM_TI_C2000WARE_INCLUDE_PATH : "C:\ti\c2000\include" or "C:\ti\c2000\C2000Ware_DigitalPower_SDK_5_04_00_00", no include folder inside C2000Ware_DigitalPower_SDK_5_04_00_00

    Thanks,

    Hongmei Wan

  • Hi Hongmei,

    These links wouldn't exactly point to an include folder, they are just pointing to a high-level directory where files which are #included in your project can be found. The SYSCONFIG_TOOL_INCLUDE_PATH looks correct, you can also verify in the Products tab that you are using the matching SysConfig version as what is being used in the Include Paths.

    For the COM_TI_C2000WARE_INCLUDE_PATH , you would want to use the C:\ti\c2000\C2000Ware_DigitalPower_SDK_5_04_00_00\c2000ware path, since that one is directly looking for the nested C2000Ware folder. 

    You can also try verifying these paths by importing an empty CLB project from the examples repo and checking what the Include Path would be pointing to

    Regards,

    Peter