1-Wire interface

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User12977
Level 1
Level 1
Hi @ all,

does anyone have a App or library for using OneWire/1 -Wire EEPROMs, Sensors, with the XMC series?

Thanks
0 Likes
7 Replies
Andi_H
Employee
Employee
First solution authored First like received
Hi,

yes i have some code for the DS18B20 Sensor with the xmc4500. Thats working with DAVE 4 Apps (Digital IO). I could share it over dropbox or you give me your mail adress.

Best regards

Andi
0 Likes
nibu
Level 1
Level 1
First like given First reply posted First question asked

Hi @Andi_H ,

I have an XMC4700 and I'm trying to make it work with the DS18B20, do you still have the code and by any chance could send it to me.

Best regards,

nibu

0 Likes
User12775
Level 5
Level 5
First solution authored First like received
To my knowledge, there is no standard OneWire protocol exists. Even someone gives you a test library, a through test could not be avoided.
0 Likes
User15690
Level 1
Level 1
hi Andi, can you also email to me the example for DS18B20. Im currently using xmc1400 boot kit. Will it be compatible with xmc1400?

thank you
0 Likes
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
Hi,

There are several libraries that can be ported easily.

https://github.com/jensnielsen/ds18b20
https://github.com/farshield/ds18b20

Regards,
Jesus
0 Likes
User15690
Level 1
Level 1
Hi jferreira,

Thank you for your response. I will test the links you provided.

Regards,
Ilde
0 Likes
JaydenCai
Level 4
Level 4
25 replies posted First solution authored 25 sign-ins

 

Yes, there are several libraries available for using OneWire/1-Wire EEPROMs and sensors with the XMC series microcontrollers. One popular library is the Dallas Semiconductor OneWire library which provides a simple interface for communicating with 1-Wire devices.

To use this library with XMC microcontrollers, you will need to modify the code to work with the specific hardware and pin configuration of your XMC device. Here is an example of how to use the OneWire library with the XMC1100 series:

 

Copy Code

#include <xmc_gpio.h>
#include "OneWire.h"

#define ONEWIRE_PORT P2_6

int main(void)
{
    // Initialize GPIO module
    XMC_GPIO_Init();

    // Set the OneWire pin to output mode
    XMC_GPIO_SetMode(ONEWIRE_PORT, XMC_GPIO_MODE_OUTPUT_PUSH_PULL);

    // Initialize the OneWire library with the OneWire pin
    OneWire_Init(&ONEWIRE_PORT);

    // Search for all connected 1-Wire devices on the bus
    uint8_t i;
    uint8_t addr[8];
    uint8_t count = 0;
    while (OneWire_Search(addr))
    {
        count++;
    }

    // Print the number of connected devices
    printf("Found %d 1-Wire devices.\n", count);

    return 0;
}

Note that this is just a basic example and you will need to add additional code to read and write data to your specific 1-Wire devices. Additionally, you may need to adjust the pin configuration to match your specific hardware setup.

0 Likes