Page 1 of 1
Library for ds2413
Posted: Sat Aug 08, 2020 10:54 am
by Naveen
Hy,
I'm using Ds2413 one wire ic to control the many gpios.It was worked well with Arduino.But I wish to implement project with STM32,is there any library for stm32?
Re: Library for ds2413
Posted: Sat Aug 08, 2020 1:03 pm
by dannyf
they aren't that difficult to build:
1. start with routines that transmit "1" and "0";
2. build routines that transmit bytes, using the routines above;
3. build routines that transmit commands and data, using the routines above.
#1 and #2 are physical layers and #3 is the logic layer. the key is that those routines are fairly slow so you want to use interrupt, or creative use of other hardware modules, like the spi or uart, for those purpose.
Re: Library for ds2413
Posted: Mon Aug 10, 2020 12:21 pm
by Naveen
Hy,
Sorry I can't understand what you told. can you explain little more detail. I saw onewireSTM library in github.is this library working for that IC.
Re: Library for ds2413
Posted: Tue Aug 11, 2020 12:36 am
by mrburnette
Naveen wrote: Sat Aug 08, 2020 10:54 am
Hy,
I'm using Ds2413 one wire ic to control the many gpios.It was worked well with Arduino.But I wish to implement project with STM32,is there any library for stm32?
The latest Adafruit library may work as-is, if required porting should be very easy:
https://github.com/adafruit/Adafruit_Le ... uit_DS2413
Re: Library for ds2413
Posted: Tue Aug 11, 2020 9:27 am
by Naveen
I modified the code from Adafruit.But always i got no address found.But the two libraries are same.
Code: Select all
#include <OneWireSTM.h>
OneWire net(PA12);
uint8_t address[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
void setup(void) {
Serial.begin(9600);
}
void loop(void) {
byte i;
byte present = 0;
byte addr[8];
if (!net.search(address)) {
Serial.print("No more addresses.\n");
net.reset_search();
delay(250);
return;
}
Serial.println("");
Serial.print("R=");
for ( i = 0; i < 8; i++) {
Serial.print(address[i], HEX);
Serial.print(" ");
}
if (OneWire::crc8(address, 7) != address[7]) {
Serial.print("CRC is not valid!\n");
return;
}
if (addr[0] != 0x3A) {
Serial.print(" is not a DS2413.\n");
return;
}
}
Re: Library for ds2413
Posted: Thu Aug 13, 2020 12:05 pm
by stevestrong
Use another pin, because PA11/PA12 are reserved for USB.