Comments (5)
At the top of SoftWire.cpp
this comment explains a potential problem with interrupts:
// If possible disable interrupts whilst switching pin direction. Sadly
// there is no generic Arduino function to read the current interrupt
// status, only to enable and disable interrupts. As a result the
// protection against spurious signals on the I2C bus is only available
// for AVR architectures where ATOMIC_BLOCK is defined.
This thread suggests there may be an atomic block implementation for the STM32 that could be used.
However I don't know that interrupts are the cause - what happens if you disable interrupts before read()
and enable them afterwards?
from softwire.
I've tried disable interrupts in llRead(), but the problem persisted. I've tested another software I2C library, SWire link. It works fine with stm32duino and didn't disable interrupts. Thus, I believe the problem with SoftWire isn't related to interrupts.
from softwire.
Did you allocate buffers and pass them into SoftWire
using the setTxBuffer()
and setRxBuffer()
functions? A newly-added example, ReadDS1307
demonstrates this.
from softwire.
Hey @stevemarple, I'm also testing your library and I can get it to work for the stm32duino witch is this one Arduino Core Stm32, and not the one that you've published. I'm not sure if @pacman1945 is looking for the SoftWire for the core that you mentioned because it's native and works pretty well.
But returning to the question, I've tested with the code for detecting devices and it detects my device, the problem is, there is no response from the devices when I actually do a transfer to the device, the data coming out is always 0, when I change the library to this one SoftWire from Arduino STM32.
Do you have any idea what that might be?
from softwire.
I was just having terrible problems with this library on STM32 (STM32F103C8T6), needing a logic analyzer to ferret out the problem, and also a code problem, which was working fine when using the wire library.
The job was a reverse engineering on some Alibaba Ali Express mystery boards, a port from a SAMD / Arduino Zero to STM, and the schematic was botched, requiring software I2C. Doing this work in Platform.io, with soft input pullups enabled. The chip I'm developing on seems to be a legit STM32F103C8T6, I can confirm the same behavior on clearly counterfeit chips as well. Literally spent 5 weeks banging my head against this problem. I could write registers, but couldn't read them.
This may not be the same problem exactly, but the chip and symptoms are.
This is the change that made it live.
iTwoSea.beginTransmission(DevAddr);
iTwoSea.write(RegAddr);
iTwoSea.endTransmission();
//iTwoSea.endTransmission(false); // Original code - This line screws up soft I2C
iTwoSea.requestFrom(DevAddr, (uint8_t)4);
The SDA line wasn't dropping to switch to receive. Getting rid of (false) fixed it.
from softwire.
Related Issues (20)
- configure SoftWire and set up buffer HOT 1
- setSclLow in the example and setSetSclLow in the include file. HOT 1
- I2C EEPROM example not working correctly (Wire functions used) HOT 1
- Better documentation of run-time setting sda and scl pins HOT 1
- Can't compile the SoftWire_MLX90614 example HOT 1
- Softwire and Heltec OLED HOT 1
- Adafruit_MLX90614 and MAX30102 Not working HOT 5
- Bug in DS1307 hour in case of 24h mode
- Bug in DS1307 hour in case of 24h mode HOT 1
- calling setClock(0) made arduino micro unrecognizable by windows HOT 5
- Restart condition is not issued HOT 5
- Information request HOT 1
- llStartWait() case nack needs to include break or return HOT 3
- Minimum SCL frequency HOT 5
- Not available on rp2040 (raspberry pie Pico).
- PCF8583 event counter not woking with SoftWire HOT 10
- Air001 sw.write() output is missing HOT 1
- Wire.onRequest(handler) Support?
- softwire i2c for liquid crystal lcd
- example SoftWire_MLX90614 not working
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from softwire.