I'd like to be able to run the MIBSPI1 in master mode while MIBSPI3 is in slave mode, but am having trouble getting it set up. To test the operation, I've externally wired up the CLK from MIBSPI1 to the CLK for MIBSPI3 and the MOSI on MIBSPI1 to the MOSI on MIBSPI3 with no other external hookups. In my main function I have the following:
{ /* USER CODE BEGIN (3) */ uint16 TX_data[8] = {0x1,0x2,0x3,0x4,0x5,0x6,0x7,0x8}; uint16 RX_data[8] = {0}; uint16 i=0; sciInit(); mibspiInit(); rtpInit(); ti_printf("Done Initializing\r\n"); mibspiSetData(mibspiREG1, 0, &TX_data[0]); mibspiSetData(mibspiREG3, 0, &TX_data[0]); mibspiTransfer(mibspiREG1, 0); mibspiTransfer(mibspiREG3, 0); while(mibspiIsTransferComplete(mibspiREG3, 0) == FALSE); mibspiGetData(mibspiREG3, 0, &RX_data[0]); ti_printf("Got Data"); for(i=0;i<8;i++) { ti_printf("RX_D[%d]: %d\r\n", i, RX_data[i]); } while(1); /* USER CODE END */ }
and have messed with the order of setdata/transfer and if I'm waiting for the transfer complete on REG1 or REG3. In my real application, the slave spi (MIBSPI3) will only be receiving data while my master (MIBSPI1) will only be sending data - so I think this is a realistic test.
Any suggestions on getting it properly set up? In HalCoGen, I've set the baudrate for both to 12.5 MHz, charlen of 16, and TG0 to have a length of 8.