Replies: 1 comment
-
The constructor for an SPI object always calls init() supplying all arguments but the SPI id. So with respect to the SPI object there should be no difference. But there is a subtle side effect between using a single call and splitting set-up in two calls. Even with the call
Both |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have an object encapsulating an SPI interface and a CAN controller. It was ... flaky ... not so much that it would work/fail, more that it was working then stopped working. Anyway, the fix was to replace
with
The actual specific failure was that the constructor
MCP2515.MCP2515(self.spi, self.cs, baudrate=250000, crystal_freq=16000000)
was failing with a communication timeout, hence pointing the finger at SPI.I had a look at what I assume is the underlying code (https://github.com/micropython/micropython/blob/master/ports/esp32/machine_hw_spi.c#L422) but don't know enough about Micropython internals to really be able to make a difference - other than to see that the 'constructor with params' method does not merely construct then call init so errors are bound to creep in.
Anyone in a position to fix this?
Beta Was this translation helpful? Give feedback.
All reactions