Giter Site home page Giter Site logo

nimaltd / ds18b20 Goto Github PK

View Code? Open in Web Editor NEW
137.0 13.0 43.0 681 KB

ds18b20 library for stm32 hal

License: GNU General Public License v3.0

C 100.00%
ds18b20 stm32 hal library freertos stm32f1 stm32f4 stm32f3 stm32f2 stm32f7 stm32f0 stm32cube cubemx project

ds18b20's Introduction

ds18b20 library

ko-fi


I convert TM Library to Hal . www.stm32f4-discovery.net
I hope use it and enjoy.
I use Stm32f103vc and Keil Compiler and Stm32CubeMX wizard.
Please Do This ...

1) Enable FreeRTOS
2) Config a Gpio and a timer on CubeMX . 1us per tick example 72 MHz cpu >>> Prescaler=(72-1) counter period=0xFFFF
3) Select "General peripheral Initalizion as a pair of '.c/.h' file per peripheral" on project settings.
4) Config your ds18b20Config.h file.
5) call Ds18b20_Init(osPriorityNormal) on your app.
6) You can see result on debug . watch : ds18b20.

ds18b20's People

Contributors

nimaltd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ds18b20's Issues

Does not work in other IDE (cannot find device)

Hey. I tried your example and everything works fine!
However, if you try to repeat it with the same settings in the STM32CubeIDE environment (https://www.st.com/en/development-tools/stm32cubeide.html) or another similar IDE Clion everything stops working. Just can't find a device according to the debug. Tell me what is wrong with the library and why it is so sensitive to changing the IDE. For an example of an error attached the project in STM32CubeIDE with identical settings.

Test_ds.zip

Low frequency device

Hey,
I've used the library with same clock configuration and it was working great.
Now i'm using it with a low frequency configuration (32Mhz , no external clock) and i've problems reading from sensor ,it's always at Zero.
I've tried to change the timer counts (PRS) from 71 to 31 to stay aligned with the 1us delay but no success.
Since it's supporting FreeRTOS , could we just use the osDelay() instead of a hardware timer ?
Any solutions for my problem ?
Regards

Please check this tip, it might be interesting to update the library.

The DS18X20 B7 chip die (found in the DS18B20, DS1820S, and DS1822 products) can experience EEPROM data corruption failures during power on reset.

Since the EEPROM holds internal trim values (in addition to the user data in the TH and TL registers) that control the conversion process of the DS18X20 this may show up as inaccuracy of temperature readings. And can cause temperature measurement errors of up to ±60°C.

Source: [DS18B20, DS18S20, and DS1822] Potential corruption issues!?

doesn't work in nonRtos mode

Hi! i had download, setup and start this code at mine prj. no freertos.
TIM2 (no nvic int). 72mhz/ 72 -1 prescaler, 0xffff counter period. no interrupts
pin GPIOB 12
one ds18b20 (later will be two)

Ds18b20_Init return true in main begin before for(;;)
Ds18b20_ManualConvert calls every 20 secs and return true always
but, no temperature and no dataisvalid
i can see ds18b20 adress only.

this is my log:
16:37:33.222> initok
16:37:33.222> TimeDate: 21.09.16 4 16:37:28
16:37:33.911> readok
16:37:33.911> ds18b20[0]: 28 ff 4 99 50 17 4 bd
16:37:33.911> ds18b20[1]: 0 0 0 0 0 0 0 0
16:37:34.029> ds18b20[0]Temperature): 0
16:37:34.029> ds18b20[1]Temperature): 0
16:37:34.029> ds18b20[0]DataIsValid): 0
16:37:34.029> ds18b20[1]DataIsValid): 0

Very long and unreliable startup, unreliable reading

Hi,
I am using your code with STM32F411 (disco board) and some chinese probe based on DS18B20.
I am using CubeIDE but I've modified a few places in code to let is find all definitions and I've got the code running.
However, the temperature read from DS18B20 is extremely unstable and unreliable, making the sensor totally unusable.
The task is called as it should be, the DS18B20 address is detected correctly (I can see the address in the debug), usually the temperature is read correctly once and then the data is not read (isValid=0) for dozen seconds (sometimes minutes). After this time the data is read once again and then is invalid again.
image
Sometimes the situation is even worse - I don't even get the address of the DS18B20.
I lowered the update interval timeout to 1000ms but this doesn't seem to cause the issue because I have the same problems when the timeout is set to 10000ms or even 20000ms.
Is there something I am missing which causes these problems? Can this be made more reliable some way?

EDIT - after some debugging I see that the issue is the CRC which is invalid (crc is not equal to data[8]). There are values within data[] are partially just series of 1s like this:
image

代码可以再MDK F401上使用。不过有BUG

1.看门狗,需要在OneWireDelay(1000);附近增加看门狗。
2.当传感器数量大于设置(默认_DS18B20_MAX_SENSORS = 1)得最大数量时候会溢出。增加if(TempSensorCount>=_DS18B20_MAX_SENSORS)break;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.