Open saurabh984 opened 9 years ago
Hi
Sorry I'm not familiar with the Atmel mcu's and to be honest I haven't looked at this project for ages... But as far as I can tell I don't see any problem with your implementation, what kind of problem do you have? Do you have an oscilloscope to check the behaviour on the wire? Are you running with or without OS?
BR /Jens
Hi Jens,
Thank you for replying. I wish I had an oscilloscope or a logic analyser. Flying blind here. No OS. I guess it has something to do with timings. SAM D21 is a 48Mhz Arm Cortext M0+ CPU.
Any suggestions on the 5 defined time segments in your code? I'll try an find an analyser to see the what's going on.
Thanks again Saurabh
Sent from my iPhone
On 26 Dec 2014, at 9:20 am, Jens Nielsen notifications@github.com<mailto:notifications@github.com> wrote:
Hi
Sorry I'm not familiar with the Atmel mcu's and to be honest I haven't looked at this project for ages... But as far as I can tell I don't see any problem with your implementation, what kind of problem do you have? Do you have an oscilloscope to check the behaviour on the wire? Are you running with or without OS?
BR /Jens
Reply to this email directly or view it on GitHubhttps://github.com/jensnielsen/ds18b20/issues/3#issuecomment-68132478.
Onewire is generally very insensitive to timing so you shouldn't need any particular precision on your delay function (I just use loops...)
I haven't double checked now and don't really remember but I should have chosen the delays somewhere in the middle of the allowed range so your delay function can be off in any direction without causing problems.
So unless your delay function is completely off (incorrectly configured clock or something) you should be fine. Maybe you can check the timing by using the delay function to just flash a led with 1 Hz? I don't think you need any better precision than you can verify by eye.
Otherwise I would double (or triple) check the wiring, I never implemented the parasite mode so you need all three pins (or modify the software accordingly) and make sure you have the proper pull-up.
BR /Jens
Hi Jens,
Used the the onboard LED to verify the timing. It does seem correct. Even connected an LED to the pin instead of DS18B20 and it flashed I think 4 times which is the scan function. I'm not using parasite power mode.
Going to check if the sensor is working with Arduino to make sure it's not that which isn't working.
Thanks again for your help. I'll raise a PR for SAM D/R 21 owhal if I get this working.
S
Sent from my iPhone
On 26 Dec 2014, at 12:33 pm, Jens Nielsen notifications@github.com<mailto:notifications@github.com> wrote:
Onewire is generally very insensitive to timing so you shouldn't need any particular precision on your delay function (I just use loops...)
I haven't double checked now and don't really remember but I should have chosen the delays somewhere in the middle of the allowed range so your delay function can be off in any direction without causing problems.
So unless your delay function is completely off (incorrectly configured clock or something) you should be fine. Maybe you can check the timing by using the delay function to just flash a led with 1 Hz? I don't think you need any better precision than you can verify by eye.
Otherwise I would double (or triple) check the wiring, I never implemented the parasite mode so you need all three pins (or modify the software accordingly) and make sure you have the proper pull-up.
BR /Jens
Reply to this email directly or view it on GitHubhttps://github.com/jensnielsen/ds18b20/issues/3#issuecomment-68139496.
Alright, sorry I couldn't be of any more help but now I don't know what else could be wrong. I'm quite biased to believe my code is correct... :)
If you're using my ds18b20.c as it is without any devices on the bus I think you should see two resets (bus low for ~500ms), one by the scan function which stops if it doesn't find any devices and another when issuing the first convert command. Maybe you can see something from the two bytes written to issue the actual command as well but after that it should be stuck waiting for any device to signal that conversion is complete. (That implementation could use some improvement but as I wrote in the readme it's just a dummy/guide to show how it can be used...)
Anyway, just let me know if you need any more help. I hope you can get it working, I'd be happy to pull your code
//Jens
Has there a resolution porting ds18b20 code to samd21, regards
This thread seems like its most likely dead, but was there ever a resolution here? I've ported this code for the SAMD21 but reading a bit always reads 1, and never 0.
Yeah sorry I haven't used this stuff in several years and I don't have a samd21 to test with.. If anyone wants to contribute I'd be happy to pull it in though.
Hi,
I've been trying to port this to SAM D21 with no luck. Would it be anyway possible for you take a look and see where I might be going wrong? SAM D21 has a delay.h library with microsecond timeouts.
Thank you so much in advance!