Hi,
I'm new to mibspi and I'm having trouble getting it going. I've looked at an example project and read through the documentation, but I seem to be missing something. Hopefully it is just a lack of understanding.
I am using CCS5.5 with the TMS570LS0332 and Halcogen 4.0. I have an IO expander (Microchip MCP23S17) which connects through mibspi1, CS 2. I have enabled the mibspi driver and I think I have it set up correctly in Halcogen.
Based on the datasheet for the IO expander, I need to send the 8 bit device opcode (0x40 for a read) followed by the 8 bit register address (0x12) and then my 8 bit data (0x00).
The example code is
unsigned short m_data_out[8] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}; /* 8 data of 16 bit length each */ /* Write data to ram for transfer */ spiSetData(spiREG1,0,m_data_out); /* Enable the transfer by setting enable bit of TG0 ctrl reg to 1 */ spiTransfer(spiREG1,0);
But I don't see where the device opcode/register address is supposed to go. Is it part of the data_out that gets set in SetData,
so my array should look like {0x40, 0x12, 0x00}?
I have tried this and it doesn't work, clearly I am doing something wrong, but I can't tell what it is.
Thanks,
David