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.

MibSPI1 is not Working

Other Parts Discussed in Thread: TMDXRM46HDK, HALCOGEN

I am using tmdxrm46hdk. I have configured MibSPI as 

/* MIBSPI1 set all pins to functional */
mibspiREG1->PC0 = (uint32)((uint32)1U << 0U) /* SCS[0] */
| (uint32)((uint32)1U << 1U) /* SCS[1] */
| (uint32)((uint32)0U << 2U) /* SCS[2] */
| (uint32)((uint32)0U << 3U) /* SCS[3] */
| (uint32)((uint32)0U << 4U) /* SCS[4] */
| (uint32)((uint32)0U << 5U) /* SCS[5] */
| (uint32)((uint32)0U << 8U) /* ENA */
| (uint32)((uint32)1U << 9U) /* CLK */
| (uint32)((uint32)1U << 10U) /* SIMO[0] */
| (uint32)((uint32)1U << 11U) /* SOMI[0] */
| (uint32)((uint32)0U << 17U) /* SIMO[1] */
| (uint32)((uint32)0U << 25U); /* SOMI[1] */.

I am not using DMA. I am using Aardvark as slave device. I am using only one transfer group. When i enable the transfer group, Tx completion flag is set but nothing is displayed on Aardvark. The Rx values are 0xffff. The MibSPI is working fine in Loopback mode. 

Please suggest what could be cause of this problem.

Thanks,

Naveed

  • If you are using the MibSPI with the Mib unit enabled in slave mode, then you can only use the first transfer group and you need to have it triggered from SCS[0].  It looks like you have other SCS's setup which is likely the issue.

  • Thanks Anthony for the reply. I am using MibSPI in Master mode. I also tried to use HALCOGen code but i was unable to install XDS100V2 driver on 3 PCs. I have installed Code composer studio on those PCs but It didn't worked out as well. Should I enable only slave in Master mode as well?

  • Naveed

    Sorry I missed the part where you said AARDVARK was a slave and assumed it was a master.

    You should be able to leave the MibSPI as a master but I don't know the details of the aardvark setup as a slave.  Have you confirmed that AARDVARK is responding by checking the SOMI[0] pin on the MCU?   Also which board are you using and have you confirmed that the signal makes it back to SOMI[0]?

    The XDS100v2 has nothing to do with the MibSPI so I would treat the XDS100v2 problems as unrelated.   Can't really comment on what the problem with the XDS100v2 is without knowing more about what the error is.   For starters - there is a 'Test Connection' button that comes up in CCS when you open the target configuration - and this is the first check to make - is it passing or failing and what if any error messages do you get.   If test connection fails but then when you open a debug session you get failures when you try to 'connect' to the device - then we need to know what those errors are.

  • Anthony,

    For now lets leave the part of XDS100V2. The Aardvark setup is simple. I have just set phase, polarity and clock and enabled slave mode of Aardvark. Aardvark is working fine when i use it with SPI2. However, I have not confirmed the signals from MCU yet.

    To me it looks like an issue related to Pin Mux. If the device is working fine in Loopback mode, It ensures that TX, RX path is working fine. Since, I am unable to see data transmitted in wire so It looks like a Pin Muxing issue. Does this make sense?

    I have also used Pin Muxing generated from HALCOGen but that appeared to fail as well. I am using ti_tmdxrm46hdk.

    Do you have any working sample of MibSPI for this board?

    Thanks,
    Naveed
  • Naveed,

    First, let's start with the board. on the RM46 HDK, SPI1 routes through the switch device U10 and it's signals may not be connected to the expansion header.   The routing is controlled by the DIP switch S2.  How do you have the switches on S2 configured?  S2 's USB_HOST_ON and ETHERNET_ON switches need to both be in the OFF position, otherwise the MibSPI pins get routed somewhere else like either to the ethernet phy or to the USB phy...

    After you check that - Example_SPI_Master_Slave.c is included with HalCoGen for the RM46 is a something you could run.  It will use MibSPI1 in SPI mode but that is OK for testing the basics like you are trying to test now.  The MIB unit is an additional sequencer to string together multiple SPI transactions and it's good you are trying this but if you can't even get a basic transaction and are questioning hookup and pinmux then the simpler SPI mode test is the place to start. 

    Regarding pinmux - Did you create an RM46 project in HalCoGen?  Pinmux is different between the RM48, RM46 and the RM42 so if you didn't and say you created an RM48 project but are trying to run it on the RM46 - this could definitely be a problem.

    That's probably enough - if you are still stuck after checking these things then posting a dump of the SPI1 registers while you expect that it should be or have already transmitted data is probably the next thing to do.  There are plenty of status registers that tell what's going on so these can be checked for more information.

  • Anthony,

    The issue was with S2 switch settings. I am using "Texas_Instruments-TMDXRM46HDK-datasheet" and it does not explain MibSPI1 routing. It only explains about Ethernet and USB on / off setting.

    Table 2-11. S2 DIP Switch Functions

    Switch

    OFF Position

    ON Position

    S2:1 (1)

    USB Host0 Disabled

                      USB Host0 Enabled

    S2:2 (2)

    USB Host1 Disabled

                USB Host1 Enabled

    S2:3 (2)

    USB Device Disabled

                       USB Device Enabled

    S2:4 (3)

      Ethernet Disabled

                 Ethernet Enabled

    (1) S2:1 indicates slide 1 on the S2 DIP switch, S2:2 indicates slide 2 on the S2 DIP switch, and so on.

    (2) S2:2 and S2:3 cannot be enabled at the same time since those two ports have pinmux.

    (3) To use Ethernet, S2:4 should be enabled and all other have to be disabled.

    The good thing is I am now able to transmit data but i am having completely strange behavior on receive side. I am only able to receive one Byte from Aardvark(slave). The rest of the received is same as TX. e.g. 

    UINT16 txBuffer[] = {0x00, 0x11, 0x22};
    UINT16 rxBuffer[3];
    
    After completion of transaction the content of rxBuffer will be like
    
    rxBuffer[3] = {Byte_From_Aardvark, 0x00, 0x11}
    I have loopback mode disabled but don't know why this data is being loopedback on RX side.
    I have attached the complete register dump of MibSPI1 4118.MibSPI_Reg_Dump.txt.
    Thanks,
    Naveed

  • Hi Naveed,

    Great glad the first issue was as simple as the switch settings. 

    I'm not sure that the register dump will help with the data receive issue you are having - at least not as a next step - that was something I was thinking of for the pin issue in case S2 didn't work out.

    For the rx buffer issue - I am not sure how to help you with the information above.  Just seeing two arrays in RAM (one for txBuffer and one for rxBuffer) doesn't really say much about how the data is transferred from the MibSPI to/from these buffers.
    Need a lot more information about that in order to suggest a next step.

     

  • Anthony,

    I have configure Data format as
    character_length = 8
    prescaler = 109
    clock_phase and polarity = 0
    shift_direction = MSB 
    parity_enable = 0
    I have configured the transfer group as 
    trigger_source = TRIG_DISABLED
    trigger_event = TRIG_ALWAYS
    transfer_mode = Oneshot
    length = 8
    The functional pins as follows:
                          (1U << 0U)    /* SCS[0] */
                        | (0U << 1U)    /* SCS[1] */
                        | (0U << 2U)    /* SCS[2] */
                        | (0U << 3U)    /* SCS[3] */
                        | (0U << 4U)    /* SCS[4] */
                        | (0U << 5U)    /* SCS[5] */
                        | (1U << 8U)    /* ENA */
                        | (1U << 9U)    /* CLK */
                        | (1U << 10U)   /* SIMO[0] */
                        | (1U << 11U)   /* SOMI[0] */
                        | (0U << 17U)   /* SIMO[1] */
                        | (0U << 25U)); /* SOMI[1] */
    The TX RAM control is initialized as follows:
    buffer_mode = CONTINUOUS_MODE
    chip_select_hold = 0
    data_format = DATA_FORMAT0
    chip_select = CS_0
    group = 0
    In next step i fill the TX RAM data and enable the transfer group. The data is transmitted correctly to Aardvark but the data sent by Aardvark is not received properly. 
    Please let me know, If you require any specific information.
    Thanks,
    Naveed

  • The issue was resolved by incorporating delay between SPI transactions. I have set wdelay = 50 and now i am able to TX and RX properly. 

    Thanks Anthony for your support.