Comments (5)
If I assume you are talking about the DS18B20, take a look at the datasheet on page 8. There are two aspects to consider:
-
The 64-bit ROM code - this is eight 8-bit bytes (octets), where the LSB is the family code, the next 48 bits (6 bytes) is the serial number, and the last 8 bits (eighth byte) is the CRC. The struct that you pasted is this ROM code.
-
The scratchpad is nine bytes (see Figure 9) - and yes, the last byte is the CRC byte. But the code you pasted isn't the scratchpad struct, it's the ROM code struct.
The relevant struct is here:
typedef struct
{
uint8_t temperature[2]; // [0] is LSB, [1] is MSB
uint8_t trigger_high;
uint8_t trigger_low;
uint8_t configuration;
uint8_t reserved[3];
uint8_t crc;
} Scratchpad;
This has a size of nine bytes.
Please let me know if this isn't clear.
from esp32-owb.
I see. I am using AWS FreeRTOS which is compiled in C instead of C++, so I was using your library as reference and rewriting it for C and when adding CRC bit I checked OWB library portion.
And inside owb_read_rom() function there is a call for
if (owb_crc8_bytes(0, rom_code->bytes, sizeof(OneWireBus_ROMCode)) != 0)
where sizeof(OneWireBus_ROMCode is 8 and inside ds18b20_read_temp() function there is a line
if (owb_crc8_bytes(0, buffer, 9) != 0)
which sets the data length to 9.
Since I was looking for CRC implementation example, I looked only at owb library and it confused me as in my code it works only with the length of 9. I am working with MAX31850K and I know all addresses of the devices I made a very simple implementation of the library and overlooked few things from DS18B20 library.
Thank you very much for helping to clarify things for me and thank you for your work on this library.
from esp32-owb.
Fair comment - I should get rid of that 9
and use the actual struct size. Thanks for pointing that out.
BTW, this library is written for C & FreeRTOS. It is not a C++ library, although I do have some header guards in case someone does try to compile with C++. Therefore it should work with AWS FreeRTOS out-of-the-box. Also I believe someone has successfully used my DS18B20 library with the MAX31850: DavidAntliff/esp32-ds18b20#4
EDIT: sorry, just noticed you're the same person as issue 4 :)
from esp32-owb.
Hi,
your demo worked perfectly for me, but when I was trying to include it into my AWS FreeRTOS demo I had issues compiling and when I was trying to debug I thought It was something because of C++. Anyways, it just shows how improficient I am. I remember it was something that it couldn't find definition for reset() function which was actually defined as _reset(). Anyways, I could have posted a proper debugging output but new AWS FreeRTOS got released with so many changes in their libraries, so I got occupied trying to migrate to new stuff. I hope in next couple days I will have a chance to give another try of adding your library. I really appreciate your help, thank you for your time.
from esp32-owb.
I'll address this here: DavidAntliff/esp32-ds18b20#5
Closing this issue for now.
from esp32-owb.
Related Issues (20)
- owb_verify_rom blocks, if no one wire device is connected HOT 9
- Parasite power HOT 12
- RMT not working while GPIO is HOT 13
- Parasitic Power Mode HOT 3
- Packed Union HOT 4
- Issues caused by owb_rmt_driver_info going out of scope HOT 2
- Bad device on bus causes ds18b20_check_for_parasite_power to hang HOT 4
- Offload bus access to RMT peripheral HOT 2
- Example HOT 4
- Example schematic HOT 5
- Cache disabled but cached memory region accessed error when writing to flash HOT 9
- not compiled with esp32c3 HOT 7
- RMT "Write 1" LOW duration too short HOT 1
- Depreciation message for rmt.h HOT 21
- Using in Arduino Espressif32 framework HOT 1
- Latest version updated in PlatformIO library?
- unable to read DS18B20 temperature while connected to wifi HOT 1
- Looks like some functions are being depricated HOT 4
- Platformio: error during installation HOT 1
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 esp32-owb.