Dallas Onewire read device id only

zamek42@gmail.com
Posts: 34
Joined: Sat Dec 02, 2017 7:27 pm

Dallas Onewire read device id only

Postby zamek42@gmail.com » Tue Aug 17, 2021 11:14 am

Hi All,

I need to use a Dallas 1wire iButton, which has only a read only id. I found a library for 1wire from David Antliff. I used this simple code:

Code: Select all

static void ibutton_task(void *param) {
    OneWireBus_SearchState search_state = {0};
    if (!owb)
    	LOGD(TAG, "owb is null");
    vTaskDelay(5000);
	owb_rmt_driver_info rmt_driver_info;
	owb=owb_rmt_initialize(&rmt_driver_info, GPIO_I_BUTTON, RMT_CHANNEL_1, RMT_CHANNEL_0);
	owb_use_crc(owb, true);
	while(1) {
	    bool found = false;
	    owb_search_first(owb, &search_state, &found);
	    if (found) {
	    	LOGD(TAG, "found");
	    	char rom_code[17];
	    	owb_string_from_rom_code(search_state.rom_code, rom_code, sizeof(rom_code));
	    	LOGD(TAG, "code:%s", rom_code);
	    }
	    vTaskDelay(pdMS_TO_TICKS(IBUTTON_TASK_DELAY_MS));
	}
}
IBUTTON_TASK_DELAY_MS is 100

It works but it frequently generates an error:
E (917646) owb_rmt: rx_items == 0
E (932086) rmt: RMT RX BUFFER FULL
E (932086) rmt: RMT RX BUFFER FULL

Is there an example for getting device id only from an ibutton?

thx
Zamek

zamek42@gmail.com
Posts: 34
Joined: Sat Dec 02, 2017 7:27 pm

Re: Dallas Onewire read device id only

Postby zamek42@gmail.com » Tue Aug 17, 2021 10:40 pm

I made onewire_flush_rmt_rx_buf function to public and I call it at every cycle. Yes it is not the correct method, but it works for me.

Who is online

Users browsing this forum: No registered users and 398 guests