-
Notifications
You must be signed in to change notification settings - Fork 4
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
Problem with code #1
Comments
Hi. Thanks for letting me know. I've checked the .c file and the original line seems to be Please replace the line and let me know if the problem persists? Thanks! |
Hi
..\Inc\sht2x_for_stm32_hal.c(64): error: #53: expected a ":" |
Hello. I'm sorry that I'd only tested the code in STM32CubeIDE. I've just tested the code in Keil and ran into the same error.
It seems that the Keil compiler doesn't work well with the binary numbers I defined in the .h header file, i.e. I've replaced all binary values with hexadecimal and the errors were cleared. Please update your .h file and .c file with the new version and see if the errors persist? Thanks. |
Thanks for your consideration. The error is : |
Sorry about the first error. I changed the identifier I think the second error has to do with the binary number problem. Please update the .c file and see if they're still here? |
Thank you very much. Now there is no error in compiling. I will test the library on hardware tomorrow and I will tell the results. |
Sure thing! Thanks for your interest in my library as well. |
Hi |
Hi. Sorry about the error. This is because I accidentally defined I've moved that variable to the .c file and made it Sorry again about the inconvenience. |
You are welcome /* USER CODE BEGIN I2C1_Init 0 */ /* USER CODE END I2C1_Init 0 */ /* USER CODE BEGIN I2C1_Init 1 */ /* USER CODE END I2C1_Init 1 / /* USER CODE END I2C1_Init 2 */ } I can not see any thing on serial port |
Sorry it was my fault but now I see negative values on serial monitor and they do not change |
Hi. I also use STM32CubeMX but I'm not sure about this error. The first time I tried I also had some strange constant value and it turned out to be a soldering problem. If it's not a hardware issue, could it be the I2C problem? I configured the I2C1 mode to "I2C" and used the default settings in STM32CubeMX, but I'm not sure why our I2C functions are different. Are you having negative values like |
Yes exactly that values |
Hello. I've replicated the error with my SHT20 sensor. I think it's a small glitch with the I2C connection in no hold master mode, causing it to miss the ACK bit. Please update your .c file and see if this persists? Sorry again about the inconvenience. |
Hi |
Hi. So now you can see the proper temperature and humidity values in the serial monitor or just negative values? |
Now I can see the proper values |
That's good news! I'll revert the .c file. Thank you for your useful feedback. It helps me a lot with my future projects. Hopefully everything goes well for your project as well. |
Thank you very much, you help me a lot |
Glad I was able to help! |
Hi again |
Very sorry that I was away for the weekend. Has the problem been resolved? I used SHT20 and DS1307 in another project and there weren't conflict. I'm not sure about the LCD, but if you get negative values from the SHT20 it's likely an I2C communication problem. |
Hello. What STM32 core are you using? I think the there may be a conflict between the I2C and FSMC, as described in this post?
If your STM32 core has more than one I2C bus, maybe you can set up another I2C bus and connect your I2C devices to it, or else you can try remapping the I2C pins in STM32CubeMX? |
Hi. No problem you are welcome. I test them together with serial port and there is no problem but when using lcd, they do not work. I tested PB8 and PB9 as I2C but it did not work |
Hello. I believe the conflict between I2C1 and FSMC is documented in ST’s official errata. As a workaround, they suggested:
Since remapping doesn’t work, I think you can try their suggestion to disable the FSMC clock before calling the library functions and enable it after calling them? Or a easier workaround, I believe, is to not use the I2C1 bus for your SHT20 and DS1307 devices. (If your microcontroller has more than one I2C interface.) I think the code is identical, except that you need to pass a different I2C handle to the Init functions, for example I’m sorry that I cannot provide a better solution to this issue as I’m not familiar with FSMC, but I hope this information can help you in some way? |
I tried for solving problem but I could not. I used another board to read the snsor and send the data to main board. Thanks for your replying |
Sorry that I couldn't help. Happy to hear that you got it working though. |
Thank you very much. I share your github with my friends. they are useful libraries. Thank you |
Thank you for the feedback! Hopefully your friends find them useful as well. |
Hello and thanks for sharing code
I use the code in Keil and I add the library. when I compile the code, I have 8 errors with these statements
uint8_t cmd = (hold)?SHT2x_READ_RH_HOLD:SHT2x_READ_RH_NOHOLD;
and the error is :
..\Inc\sht2x_for_stm32_hal.c(63): error: #65: expected a ";"
What is the problem?
Do I need to make any changes in code?
Thank you
The text was updated successfully, but these errors were encountered: