3 Replies Latest reply on Dec 7, 2015 5:32 AM by helic_263931

    2 different SPI devices and Exceeded blocks

      So I have added another SPI component to my application and now how Exceeded blocks.  I found that I can just use a Control Register to switch between CS pins, but the issue is that one component accepts a 16-bit and the other is an 8-bit.  Question is, how to I send just the 8 bits when the SPI component is set to accept 16?

        • 1. Re: 2 different SPI devices and Exceeded blocks

          You can configure the SPI for 8 bits and just send 2 bytes to the SPI slave that accepts 16 bits. Just control the CS signals manually (with a control register), and not via the SPI master.

          • 2. Re: 2 different SPI devices and Exceeded blocks

            Thank you.  I've decided to take a different route, but the same issue/solution arises now.  I'm no longer implementing 2 SPI devices, but the 16-bit one is still in play and I'm getting the same error as a 16-bit transfer, so I'll need to use 8-bit, and send 2 bytes.  No more error, but now I think I have a coding issue as to how to send 2 bytes. More so, how to correctly define variable perhaps.  Below is my transfer function. buffSend is interpreted as 'uint8 cmdBuffer[SWITCHBUFF]', SWITCHBUFF being defined as 2u.  cmdBuffer[0] is the command byte, and cmdBuffer[1] is a data byte.  All of each are defined as 0x0#...0xF0, etc.  In debug, it gets stuck here: size = (0u != (SPI_Switch_RX_STATUS_REG & SPI_Switch_STS_RX_FIFO_NOT_EMPTY)) ? 1u : 0u;


            static void switchCommand(uint32 cmd, uint32 data){
                    static uint8 bufferOut[SWITCHBUFF] = {CLICKM_CMD,CLICKLESS_CMD};
                    bufferOut[CMD_INDEX] = (uint8)cmd;
                    bufferOut[DATA_INDEX] = (uint8)data;      
                    SPI_Switch_PutArray(bufferOut, SWITCHBUFF);
                    while (SWITCHBUFF != SPI_Switch_GetRxBufferSize())

            • 3. Re: 2 different SPI devices and Exceeded blocks

              Do you clear the RX buffer before this code? Otherwise it might not be empty, and then your check is invalid.


              You can also check the TX status for not being IDLE.