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.

Linux/AM3358: Unable to read Data from SPI using IOCTL

Part Number: AM3358


Tool/software: Linux

I am trying to read the data over SPI 1 from FRAM. I hav ewritten a code for the same. I am able to get the correct manufacture ID on CRO but I am unable to get the data from driver and application. It always shows 0x00. 

Below is my device tree.

AM33XX_IOPAD(0x190, PIN_INPUT_PULLUP | MUX_MODE3) /* (A13) mcasp0_aclkx.spi1_sclk */
AM33XX_IOPAD(0x194, PIN_INPUT_PULLUP | MUX_MODE3) /* (B13) mcasp0_fsx.spi1_d0 */
AM33XX_IOPAD(0x198, PIN_OUTPUT | MUX_MODE3) /* (D12) mcasp0_axr0.spi1_d1 */
AM33XX_IOPAD(0x19c, PIN_OUTPUT | MUX_MODE3) /* (C12) mcasp0_ahclkr.spi1_cs0 */

Below is the code that I am using to read Manufacture ID.

uint8 txz[1] = {0};
uint8 rxz[1] = {0};

memset(txz , 0 ,sizeof txz);
memset(rxz , 0 ,sizeof rxz);
memset(xfer , 0 , sizeof xfer);

txz[0] = RDID;

int ret;

xfer[0].tx_buf = (unsigned long)txz;
xfer[0].len = 1;
xfer[1].delay_usecs = 500;

xfer[1].rx_buf = (unsigned long)rxz;
xfer[1].len = 1;
xfer[1].delay_usecs = 500;
ret = ioctl(spi_fb, SPI_IOC_MESSAGE(2), xfer);
printf("send:%.2X\n" ,txz[0]);
printf("receive:%.2X\n" ,rxz[0]);

puts("");