cancel
Showing results for 
Search instead for 
Did you mean: 

cannot communicate ST25R3916 with STM32G0 MCU

Gaston
Senior

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

1 ACCEPTED SOLUTION

Accepted Solutions
Ulysses HERNIOSUS
ST Employee

Hi Gaston,

I believe I can still see the data on MISO:

0693W000006EmkYQAS.pngThis 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

  1. Disconnect MISO from the MCU. In unpowered conditions measure the ST25R3916 protection diodes on MISO (Multimeter set to Diode Test Mode, red tip on GND and black tip on MISO pin). They should have a forward bias of about 630mV. If deviating too much I expect something else to be still connected.
  2. Measure VDD_IO and make sure it is connected to a real supply and not only a high digital signal.

Regards, Ulysses

View solution in original post

4 REPLIES 4
Ulysses HERNIOSUS
ST Employee

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

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:

  • HCLK: 64MHz (APB peripheral clocks 64MHz)
  • SPI1_SCK: PB3
  • SPI1_MOSI: PA12
  • SPI1_MISO: PA11
  • CS (GPIO): PB0
  • IRQ: GPIO_EXTI4

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

0693W000006EkIIQA0.bmp 

and for the MISO line

0693W000006EkISQA0.bmp 

What else can I try?

regards,

gaston

Ulysses HERNIOSUS
ST Employee

Hi Gaston,

I believe I can still see the data on MISO:

0693W000006EmkYQAS.pngThis 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

  1. Disconnect MISO from the MCU. In unpowered conditions measure the ST25R3916 protection diodes on MISO (Multimeter set to Diode Test Mode, red tip on GND and black tip on MISO pin). They should have a forward bias of about 630mV. If deviating too much I expect something else to be still connected.
  2. Measure VDD_IO and make sure it is connected to a real supply and not only a high digital signal.

Regards, Ulysses

Gaston
Senior

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