Other Parts Discussed in Thread: SYSCONFIG
Tool/software:
Hello,
I want to do SPI read and write with Texas MSPM0G1106 IC.
First of all, I have done SPI read and write with another MCU before. Here is the codes.
unsigned char MFRC522_SPIreceive(unsigned char address_rcv)
{
SPI_receive_address= (((address_rcv<<1)&0x7E) | 0x80);
SPI_NSS= 0;
SPI_WRITE_TX(SPI0, SPI_receive_address);
while(SPI_IS_BUSY(SPI0));
SPI_ClearRxFIFO(SPI0);
SPI_WRITE_TX(SPI0, DUMMY);
while(SPI_IS_BUSY(SPI0));
SPI_Received_data = SPI_READ_RX(SPI0);
SPI_NSS= 1;
return SPI_Received_data;
}
When I look at the debug of MCU, I can see the values I want. But when I look at the debug of Texas, I read 0xFF. Normally I should read 0x3F.

(In the picture below you can see the image taken from Logic Analayzer).

SPI Init
SPI Settings

SPI Settings
SYSCONFIG_WEAK void SYSCFG_DL_SPI_0_init(void)
{
DL_SPI_setClockConfig(SPI_0_INST, (DL_SPI_ClockConfig *) &gSPI_0_clockConfig);
DL_SPI_init(SPI_0_INST, (DL_SPI_Config *) &gSPI_0_config);
/* Configure Controller mode */
/*
* Set the bit rate clock divider to generate the serial output clock
* outputBitRate = (spiInputClock) / ((1 + SCR) * 2)
* 400000 = (16000000)/((1 + 19) * 2)
*/
DL_SPI_setBitRateSerialClockDivider(SPI_0_INST, 19);
/* Set RX and TX FIFO threshold levels */
DL_SPI_setFIFOThreshold(SPI_0_INST, DL_SPI_RX_FIFO_LEVEL_1_2_FULL, DL_SPI_TX_FIFO_LEVEL_1_2_EMPTY);
/* Enable module */
DL_SPI_enable(SPI_0_INST);
}
SPI Init Code

IC Pins
Config etc. settings are as in the pictures.
The code I use is as follows.
unsigned char MFRC522_SPIreceive(uint8_t address_rcv)
{
uint8_t SPI_receive_address = (((address_rcv << 1) & 0x7E) | 0x80);
//MFRC_NSS_OFF;
DL_SPI_transmitData8(SPI_0_INST, SPI_receive_address);
delay_cycles(500);
while (DL_SPI_isBusy(SPI_0_INST));
DL_SPI_transmitData8(SPI_0_INST, DUMMY);
delay_cycles(500);
while (DL_SPI_isBusy(SPI_0_INST));
SPI_Received_data= DL_SPI_receiveData8(SPI_0_INST);
//MFRC_NSS_ON;
return SPI_Received_data;
}
Main code
MFRC522_SPIreceive(0x11); delay_cycles(500);
Do I have a mistake in the reading code? If so, how can I fix it?
Thank you in advanced.


