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/TMS570LS1224: TMS570LS1224 :SPI communication

Part Number: TMS570LS1224
Other Parts Discussed in Thread: HALCOGEN

Tool/software: Code Composer Studio

Hello everyone,

i wanna configure SPI sensor interface with TMS570LS1224 .

anyone have a similar example to follow.

or could tell me how to start my configurations ?? 

Best regards,

  • Hello,
    You should start with configuring MCU. This can be done using HALCoGen.

    - Enable drivers for the modules you need and disable all the others (Driver enable tab);
    - Set pin multiplexing (PINMUX Tab);
    - Choose SPI Tab for configuring SPI parameters (master/slave, using interrupts or not, data format, clock mode). Most of this depends on sensor you are using;
    - If you intend to use interrupts then enable all interrupts needed for your application (VIM Channel Tabs);
    Generate code.

    Make project in CCS and start to write the code for your application.

    You should read from sensor datasheet the protocol used to communicate with sensor.

    After installing HALCoGen you will find examples under Examples folder. Within HALCoGen Help (Help topics->Examples) you will find how to use these examples. example_spi_Master_Slave.c is the example for spi communication.

  • Hello Miro,

    this is sensor datasheet (https://www.pololu.com/file/0J731/L3GD20H.pdf)

    i just enabled MIBSPI1 driver ,enabled MIBSPI1 in Pin Muxing (also disabled Pin 105 (MIBSPI1NCS_0)) ,enabled DIR of (SIMO0 ,SOMI0 ,CLK )  ,selected CS_1 in transfer Group 0

    as mentioned in the datasheet Values are guaranteed at 10 MHz clock frequency for SPI (should i change the VCLK period)

    do i need more configurations?

    Best Regards,

    Ahmad

  • Hello,

    I am not aware with this sensor but what I can see in Datasheet is that maximum SPI frequency is 10 MHz. There should be no problem working at lower frequencies. You should be careful with SPI clock modes (Clock polarity and phase -  both master and slave should be in a same mode). Clock modes are described in Section 28.2.7 of device TRM. Polarity = 0 and Phase = 1 (TRM, Figure 28-9) corresponds to sensor timing diagram.

  • Hello Miro,

    i enabled  clock phase and disabled  clock polarity in MIBSPI1 data formats ,I went to the clock tree parameter and tried to change the VCLCK1 frequency to 10MHz but i don't have a permission to do that .

    could you please help me. and what do you think do i need to enable any interrupt? 

    Best Regards,

    Ahmad

  • Hello,

    You can set SPI clock frequency from SPIn Data Formats tab in Baudrate text field.

    Using interrupts depends on your application. The interrupts available in multi-buffer mode are:
    • Transmission error interrupt
    • Receive overrun interrupt
    • TG suspended interrupt
    • TG completed interrupt

    For example you can poll TG interrupt flag or you can use TG complete interrupt to read and write new data to the buffers.

    In the example for using SPI in multi-buffer mode under HALCoGen examples folder ( example_mibspi_trigger_tick.c ) interrupts are used.

    Example for SPI in compatible mode is " example_spi_Master_Slave.c  "

    Description for both examples is in HALCoGen Help.