Implementation of 1- Wire Protocol

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Implementation of 1- Wire Protocol

4,323 Views
rajathks
Contributor II

Hi everyone,

I would like to know did anyone  work and implemented 1 wire protocol () in any Kinetis series ?

Currently im working on DS18B20 Temperature sensor with Kinetis k22 1mb flash.

Thanks & Regards,

Raj

PS:- I'm not sure its the right place to ask.

Labels (1)
4 Replies

2,866 Views
egoodii
Senior Contributor III

If anyone is interested, I have connected one-wire devices to K20 using I2C to a DS2483 'master' (as a robust '5V line driver', and to do much of the precise low-level work).  With this (and an interrupt-driven I2C interface) I can let entire sequences run as a 'low overhead' background process.  Above that I have a whole state-machine that implements complete transactions, including 'one wire find'.  I use 18B20 'temp' and 2433/2430 memory slaves.

1,013 Views
ravikasyap1717
Contributor I

Hi,

I have configured ds2482 driver successfully and can see the below details.

root@imx8mm-var-dart:/sys/bus/w1/devices/w1_bus_master1# ls
2d-000001f6cf1c power uevent w1_master_attempts w1_master_name w1_master_pullup w1_master_search w1_master_slaves w1_master_timeout_us
driver subsystem w1_master_add w1_master_max_slave_count w1_master_pointer w1_master_remove w1_master_slave_count w1_master_timeout
root@imx8mm-var-dart:/sys/bus/w1/devices/w1_bus_master1# ls
2d-000001f6cf1c power uevent w1_master_attempts w1_master_name w1_master_pullup w1_master_search w1_master_slaves w1_master_timeout_us
driver subsystem w1_master_add w1_master_max_slave_count w1_master_pointer w1_master_remove w1_master_slave_count w1_master_timeout
root@imx8mm-var-dart:/sys/bus/w1/devices/w1_bus_master1# cd ..
root@imx8mm-var-dart:/sys/bus/w1/devices# ls
2d-000001f6cf1c 2d-0000301953de w1_bus_master1 w1_bus_master2
root@imx8mm-var-dart:/sys/bus/w1/devices# cd 2d-000001f6cf1c
root@imx8mm-var-dart:/sys/bus/w1/devices/2d-000001f6cf1c# ls
driver id name power rw subsystem uevent
root@imx8mm-var-dart:/sys/bus/w1/devices/2d-000001f6cf1c# ls -al
total 0
drwxr-xr-x 3 root root 0 Jan 1 04:46 .
drwxr-xr-x 4 root root 0 Apr 28 2022 ..
lrwxrwxrwx 1 root root 0 Jan 1 04:47 driver -> ../../../bus/w1/drivers/w1_slave_driver
-r--r--r-- 1 root root 4096 Jan 1 04:47 id
-r--r--r-- 1 root root 4096 Jan 1 04:47 name
drwxr-xr-x 2 root root 0 Jan 1 04:47 power
-rw-r--r-- 1 root root 4096 Jan 1 04:47 rw
lrwxrwxrwx 1 root root 0 Jan 1 04:47 subsystem -> ../../../bus/w1
-rw-r--r-- 1 root root 4096 Jan 1 04:46 uevent
root@imx8mm-var-dart:/sys/bus/w1/devices/2d-000001f6cf1c#

I am unable to see w1_slave file in this folder.Not sure how can i do read and write operation.

0 Kudos

2,866 Views
BlackNight
NXP Employee
NXP Employee

Hi Raj,

yes, see section "1-Wire" in McuOnEclipse Components: 06-May-2017 Release | MCU on Eclipse.

I'm using it with the DS18B20 plus a one wire tag. It is an implementation for Processor Expert, Kinetis SDK v2 and I use it both in bare metal and with FreeRTOS and features an extra command line interface.

There is an update on SourceForge (see links at the end of the article), and I plan to release a new and updated version next weekend or so which includes bus scanning for devices and an implementation which does not need any timer hardware.

You can find all the sources as well as part of the McuOnEclipse library project on GitHub:

GitHub - ErichStyger/McuOnEclipseLibrary: Library of McuOnEclipse components 

See McuOneWire.c/.h and McuDS18B20.c/.h

There might be other implementations, but I'm not aware of any other for Kinetis.

I hope this helps,

Erich

2,866 Views
rajathks
Contributor II

Hi Styger,

Thanks alot for sharing . Your microsecond delay helped me alot in implementing 1 wire protocol .

Thanks & Regards,

Raj

0 Kudos