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.

TMS320F28388D: HLC Run or CLB Data Push to SPI RX Fifo Occurs First When They Use the Same Event to Trigger?

Part Number: TMS320F28388D

Hi all!

I want to use the same event(eg COUNTER_0.count_match1) to trigger the data export to spi rx fiffo and HLC. What is the behavior of the CLB for this case? Which one happens first? I want to run HLC first to prepare the data and copy it to R0 and then push the R0 to RX fifo. Is it possible?

thanks in advance.

  • Hi Erhan,

    It sounds like you will want to configure one of the HLC events to be triggered by COUNTER_0.count_match1 and then use this event to prepare the data and push it to the HLC FIFO. Afterwards, you can signal an interrupt to the CPU. Within the event handler for this interrupt, you can then push the data to the RX FIFO. The HLC should perform these instructions sequentially in priority order. Am I understanding your question correctly? Let me know if you need any more info

    Regards,

    Peter

  • Hi Peter!

    You got it true I think so.Thank you so much. To prepare mean actually to copy data from Counters to R0 to export them. Example HLC code for that is below.

    Fullscreen
    1
    2
    3
    4
    MOV C0, R0 # Copy data to R0
    MOV R2, C2 # Trigger data export
    MOV C1, R0 # Copy data to R0
    MOV R2, C2 # Trigger data export
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Data export event will be Counter 1 count match 1 and I want to export C0 and C1. Here my question is if my logic works? Or do I need to put some delay after HLC event like some dummy command (eg MOV R0,R0) to assure to export right data? Like below

    Fullscreen
    1
    2
    3
    4
    5
    6
    MOV C0, R0 # Copy data to R0
    MOV R2, C2 # Trigger data export
    MOV R0, R0 # dummy instruction
    MOV C1, R0 # Copy data to R0
    MOV R2, C2 # Trigger data export
    MOV R0, R0 # dummy instruction
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Also another question is if data export and hlc use same event to be triggered. Then what happened if they trigger at same time?

    thanks in advance. 

  • Also, in the CLB example 28,HLC and data export use same event. But  there is no info about it. And it is wrirtten that example details in the CLB Tool Users Guide.pdf but I couldn't find any info. Can we please provide more info about CLB examples?

    Many thanks in advance.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    //#############################################################################
    //
    // FILE: clb_ex28_spi_data_export_dma.c
    //
    // TITLE: CLB SPI Data Export DMA
    //
    //! \addtogroup driver_example_list
    //! <h1>CLB SPI Data Export DMA</h1>
    //!
    //! For the detailed description of this example, please refer to:
    //! C2000Ware_PATH\utilities\clb_tool\clb_syscfg\doc\CLB Tool Users Guide.pdf
    //!
    //
    //#############################################################################
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hi Erhan,

    You should not need to add any delay between the MOV instructions as the HLC will perform the MOV instructions in the order specified. 

    If your SPI data transfer and HLC use the same event trigger, you may get a race condition. Thus, it would be best to ensure that you are only triggering the SPI data export interrupt only after you are sure that the HLC has successfully moved the data from C0 and C1 to R0.

    Also, the updated version of the CLB User Guide has not been published yet, but for your convenience, I have included the updated descriptions for examples 27 and 28.

    5.1.21 Example 27 - SPI Data Export
    In this example the high speed data export feature of the CLB is used and one of the HLC registers is exported
    out of the CLB module using the SPI RX buffer. This module is only available for CLB types 3 and up.

    5.1.22 Example 28 - SPI Data Export DMA
    In this example the high speed data export feature of the CLB is used and one of the HLC registers is exported
    out of the CLB module using the SPI RX buffer. The data received in the SPI RX buffer is transferred to memory
    using DMA. This module is only available for CLB types 3 and up.

    Regards,
    Peter

  • Hi Peter!

    Thanks for your help. I made it work finally. I had to add 3mov in the HLC code to export data 2 times in one HLC event. HLC code is below.

    I used counter 2 match event to export data.

    Can you maybe confirm that my way is ok? Thanks in advance.

    cheers,

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    ADD R1, R0 # Inc R0
    MOV R3, C2 # C2 Count Match(Fifo Export Event)
    MOV R2, R2 # Dummy command
    MOV R2, R2 # Dummy command
    MOV R2, R2 # Dummy command
    ADD R1, R0 # Inc R0
    MOV R3, C2 # C2 Count Match(Fifo Export Event)
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hi Erhan,

    Glad to hear that you were able to resolve your issue. Yes, given your use case, this implementation should be ok. Please reach out if you have any other questions.

    Regards,

    Peter

  • Hi Peter!

    Yes, it costed me a day but i did it. :) Thanks a lot for your help and interest. Sure, I will.

    cheers,