SPI test in bidirectional mode

Hy everyone,

I try to test the bus api with SPI. I just connect SPI1 Output to SPI1 Input to get the data I send (loopback). I just achieve to send the data (I see the data on the bus) but I cannot get what I send…

I see that there is some problems with bidirectional communication on SPI
(wavecom.com/modules/movie/sc … php?t=1187)

I it any solution for this problem ?

adl_busSPISettings_t busSettings;
ascii data[8+1] = "\0";

	busSettings.ChipSelect =	ADL_BUS_SPI_ADDR_CS_NONE;
	busSettings.ChipSelectPolarity = ADL_BUS_SPI_CS_POL_HIGH;
	busSettings.Clk_Mode = ADL_BUS_SPI_CLK_MODE_3;
	busSettings.Clk_Speed = 25;
	busSettings.DataLinesConf = ADL_BUS_SPI_DATA_BIDIR;
	// busSettings->SPI.GpioChipSelect DC
	busSettings.LsbFirst = ADL_BUS_SPI_MSB_FIRST;
	busSettings.WriteHandling = ADL_BUS_SPI_WORD_HANDLING;

	spiHandle = adl_busSubscribe (ADL_BUS_SPI1 , (adl_busSettings_u *) &busSettings );

//returns 0

busAccess.Address = 0;
	busAccess.AddressLength = 0;
	busAccess.Opcode = 0; 
	busAccess.OpcodeLength =  0;
	busAccess.Size = ADL_BUS_SIZE_BYTE;

	sReturn = adl_busWrite(spiHandle, &busAccess, dataLen, data);
// returns 0


	sReturn = adl_busRead(spiHandle, &busAccess, size, data);
//return 0

Thanks in advance,

Best regards,

gdt

Hi gdt,

I’m pretty sure that what you are trying to do cannot work…

The read command generates the clock and decodes what is received on the bus. But at that time, the send command is already finished, so there will be no more pulses to receive on the data line…

Best Reagrds,
Jan

Apparently it’s possible on small microcontollers.

I want to use SPI to exchange data with a MCP2510 (CAN 2 SPI IC).
I think it should work if I use opcode and address but I don’t know if this IC will work properly if the clock is interrupted for 5 periods between address, opcode and data.

Thanks for your quick response

Best regards,

gdt