cancel
Showing results for 
Search instead for 
Did you mean: 

STPM33 IC SPI optocoupler issue

APV
Associate

Hi ,

We were testing STPM33 module spi communication via an optocoupler. When optocoupler is bypassed , we are able to read data from STPM33 properly.But when optocoupler is placed, data read contains CRC errors.

We tried LTV847 and 6n137 optocouplers. It looks like problem is with SPI clock line.When this line alone is bypassed , no crc error is getting.

Whether any SPI CLK parameters are there for this STPM32/33/34 like maximum recommended rise time /fall time?

What is the recommended optocoupler IC for this?

Please help asap.

Posting this in this topic beacuse STPM32/33/34 topic not found

5 REPLIES 5
David Littell
Senior III

Are you sure the SPI clock rate isn't just too fast for the coupler?

You can affect the edge rates (somewhat) via the appropriate GPIOx_OSPEEDR register.

It'd be interesting to see scope traces of the input & output of the optocoupler.

APV
Associate

To ensure that ,SPI clock is running at 2kHz... Whether we can change edge rates of SPI lines also?

With 6n137 , 40ns rise time , 27ns fall time we are getting at optocoupler o/p. Also there is a 175-200mV offset ( When optocoupler o/p is LOW, it will be around 175mV)

David Littell
Senior III

I'd think the offset is probably not helpful.

AVI-crak
Senior

6n137 has a significant capacitance of a radiating diode, which makes the on-delay, and also allows it to glow after relieving the voltage.

It is necessary to provide a bi-directional current flow for the diode. To do this, connect the resistor in parallel to the contacts of the diode, with the calculation of the operating current flowing through it. The doubled value of this current must flow through the quenching resistor, with connection to a commutating field-effect transistor of low power.

The offset is set by a third resistor, with a parallel connection to the commutating transistor. The initial offset is calculated at the maximum temperature when the diode on-off voltage is at a minimum.

There are many words here, but you will have even more paper calculations. Good luck.

Are you using the proper SPI mode (CPOL/CPHA)?

JW