-
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SHT30 read fails with SoftWire (STM32) #12
Comments
Thanks for opening the issue. |
Sorry, up now (2024.05.30) I have not seen a working version. Furthermore I have very little to no STM32 experience so I can't provide a solution. I have created these repositories (SHT31_SW and SHT31_SWW) so people have a starting point to give it a try. |
Got it working now! At least for me, the problem was not your library at all. As the SoftWire author comments on #9 you need to set the Tx and Rx buffers. Adding
as global variables and then
right before the |
Goodmorning, Do you have time to see if it can be integrated in the library?
bool SHT31_SW::begin()
{
if ((_address != 0x44) && (_address != 0x45))
{
return false;
}
_softWire->begin();
_softWire->setTxBuffer(swTxBuffer, sizeof(swTxBuffer));
_softWire->setRxBuffer(swRxBuffer, sizeof(swRxBuffer));
return reset();
} Or maybe these 2 calls need to be set before the |
I can confirm it works with the 2 integrations you suggested on the SHT31 library. As for the placement, it does not appear to matter whether the calls are made after or before the Out of curiosity, your begin function calls And just in case it has anything to do with processor clocks, I would like to point out that this is a custom board and my MCU is running on 8MHz without a crystal oscillator, as opposed to the 72MHz you would find on a standard bluepill dev board. |
@caiotbc 6 bytes is the minimum as the SHT31 library has calls that size bool SHT31::readData(bool fast)
{
uint8_t buffer[6];
if (readBytes(6, (uint8_t*) &buffer[0]) == false)
Looks like it, however it is used to be able to call sw.setClock(). Again thanks for testing, |
Created a develop branch with the solution, |
Found some test time, SHT31 + AVR UNO + SHT31_demo.ino
Works OK, so I'm going to prepare the develop branch / PR for merging. |
Hey, I'm not sure if I should be creating a new issue since it seems directly related to #5, but I can't read anything from an SHT30 sensor. I am trying to run the demo example,
getError()
returns code 0x82 if placed right afterreadStatus(),
although theisConnected()
call above it seems to return 1 as expected. By reading the other issues, it appears that using the AVR exclusive SWW library would probably solve the issue, but I can't since my board has an STM32F103C8T6. Did anyone manage to get it working using SoftWire? Thanks.The text was updated successfully, but these errors were encountered: