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.

RM48 with MIBSPI master and slave

Other Parts Discussed in Thread: HALCOGEN

I've tried the advice here: http://e2e.ti.com/support/microcontrollers/hercules/f/312/t/311317.aspx and here: http://e2e.ti.com/support/microcontrollers/hercules/f/312/t/261331.aspx but I'm still having some problems. 

I've successfully gotten my device to communicate using 1 MIBSPI, but the device is a little odd in it's operation and so I want to separate it and have MIBSPI1 be the master to send data to the device and use MIBSPI3 as a slave to receive data from the device. The working condition I have is with MIBSPI1 working as a master, and setting up the clock such that it matches the clock the device outputs - but not connecting it and using the SPI1 master clock. I would think that if I set up MIBSPI3 as nearly the same (other than a slave instead of a master) it should work, but I think I'm not clear on how to make the slave receive data.

Relevant code:

	gioSetBit(gioPORTB,2,0); //B2 is connected to V10/MIBSPI3NCS[0] (J11 pin 76)  


	mibspiSetData(mibspiREG3,0,tx); //Set slave data and transfer.
	mibspiTransfer(mibspiREG3,0); //I think I need to start slave before master
	
	mibspiSetData(mibspiREG1, 0, tx); //Set Master Data and transfer 
	mibspiTransfer(mibspiREG1, 0);


	while(mibspiIsTransferComplete(mibspiREG1, 0)==0);  // wait here until transfer is complete

	while(mibspiIsTransferComplete(mibspiREG3, 0)==0); //gets stuck here if left uncommented

	status = mibspiGetData(mibspiREG3, 0, rx);  // get received data - blank data
//	status = mibspiGetData(mibspiREG1, 0, rx);  // get received data - works if uncommented - but not desired SPI to receive data
		
	gioSetBit(gioPORTB,2,1); //raise CS

The main difference in HalCoGen between MIBSPI3 and MIBSPI1 is that I have 1 set up as master, default chip select of 0xFF while I have 3 set up as slave with default chip select of 0x01. I otherwise have the data formats, delays, transfer groups set up the same. I have the data out from the device tied to both SOMI on SPI1 and SIMO on SPI3, and the clock from the device tied to V9/J11 pin 78 on the HDK. I don't think should impact the code from working.

Any suggestions on what I'm not doing to be able to set up the slave to receive data? My suspicion is the CS line - but not sure what I can do with it.

Thanks

  • Can you pls help us with a small block diagram of what you are trying to communicate with ?

    I understand RM48 is used with MIBSPI1 in Master mode and MIBSPI3 in slave mode, bur are you looping back or trying to communicate with another device or another RM48 ?

  • It is with another device. Below is the way that I can get it to work (if I'm careful about my clock speed)

    Below is how I am trying to get it to work

    I think part of my problem is that I still dont understand transfer groups well enough and how they initiate when a slave. I was reading SPNU217b and it says: "

    When operating in slave mode, the MibSPI uses the chip-select pins 0 to 3 to generate a trigger to the corresponding Transfer Group Setting “0000” on the chip-select pins triggers Transfer Group 0, “0001” triggers TG1. When the value “1111” is set to the chip-select, the MibSPI is deselected - that is Transfer Group 15 is not available in slave mode. Chip-select pins 4 to 7 should be kept in GPIO mode."

    So perhaps I need to mess around with the chip selects.