2020-12-04 02:57 AM
Hi,
I've designed a custom board with two ST25R3916 and one STM32G0 MCU to control them using one SPI interface and two chip-select lines (CS1 and CS2). The problem is I'm able to send a SPI byte to one of the ST25R3916 devices (through CS, CLK, MOSI lines) but I have not response on the MISO line (it remains at high-impedance)
The design is based on DISCO and NUCLEO boards with ST25R3916
I've checked the power lines on my custom board and everything seems correct.
The I2C_EN is tied to GND to enable the SPI communication
How can I check if the ST25R3916 is running?
regards,
gaston
Solved! Go to Solution.
2020-12-06 11:52 PM
Hi Gaston,
I believe I can still see the data on MISO:
This would translate in 0xAA, only one bit different from expected 0x2A.
Therefore I believe that ST25R3916 is there and answering but either driving MISO pin directly against a supply or VDD_IO is not properly connected preventing ST25R3916 to properly drive MISO.
Please
Regards, Ulysses
2020-12-04 06:31 AM
Hi Gaston,
the first step should be to verify reading a register - I propose to read IC identity register 3fh by sending byte 7fh + another dummy byte on MOSI. You should see the MISO byte toggling and returning the information from DS: 2Ah.
If there is nothing I would try to open the MISO line to avoid potential issues of MCU driving it by mistake.
Also inspect the waveforms using a scope to see signal level and SPI mode.
Regards, Ulysses
2020-12-05 09:56 AM
Hi Ulysses,
Nothing. I've created a STM32 project from zero using STM32CubeIDE v1.5 and the firmware packages v1.4 for the STM32G030K8 (my implemented mcu). Next I've started a Pinout + Clock Configuration with these parameters:
SPI configuration (for running at 4Mbps)
hspi1.Instance = SPI1;
hspi1.Init.Mode = SPI_MODE_MASTER;
hspi1.Init.Direction = SPI_DIRECTION_2LINES;
hspi1.Init.DataSize = SPI_DATASIZE_8BIT;
hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
hspi1.Init.CLKPhase = SPI_PHASE_2EDGE;
hspi1.Init.NSS = SPI_NSS_SOFT;
hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_16;
hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
hspi1.Init.TIMode = SPI_TIMODE_DISABLE;
hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
hspi1.Init.CRCPolynomial = 7;
hspi1.Init.CRCLength = SPI_CRC_LENGTH_DATASIZE;
hspi1.Init.NSSPMode = SPI_NSS_PULSE_DISABLE;
if (HAL_SPI_Init(&hspi1) != HAL_OK)
{
Error_Handler();
}
the test code is very straightforward
HAL_Init();
SystemClock_Config();
MX_GPIO_Init();
MX_SPI1_Init();
tx[0] = 0x7F; // ST253916 read ID
tx[1] = 0xAA; // dummy byte
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0, 0); // Chip Select (Low)
status = HAL_SPI_TransmitReceive(&hspi1, tx, rx, 2, 1000); // send & receive
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0, 1); // Chip Select (High)
At the end the MISO line is stuck at GND (I was wrong in my previous post).
Here's the captured waveform
for the MOSI line
and for the MISO line
What else can I try?
regards,
gaston
2020-12-06 11:52 PM
Hi Gaston,
I believe I can still see the data on MISO:
This would translate in 0xAA, only one bit different from expected 0x2A.
Therefore I believe that ST25R3916 is there and answering but either driving MISO pin directly against a supply or VDD_IO is not properly connected preventing ST25R3916 to properly drive MISO.
Please
Regards, Ulysses
2020-12-09 12:47 AM
Hi Ulysses,
Looks like it was an issue related to some (bad ) soldered decoupling capacitor. I have reworked a few points and now I can see the 0x2A data on the MISO line.
Again, thanks for your help,
regards,
Gaston