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?
Library for ds2413
Re: Library for ds2413
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.
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
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.
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.
-
- Posts: 633
- Joined: Thu Dec 19, 2019 1:23 am
Re: Library for ds2413
The latest Adafruit library may work as-is, if required porting should be very easy: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?
https://github.com/adafruit/Adafruit_Le ... uit_DS2413
Re: Library for ds2413
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;
}
}
-
- Posts: 505
- Joined: Fri Dec 27, 2019 4:53 pm
- Location: Munich, Germany
- Contact:
Re: Library for ds2413
Use another pin, because PA11/PA12 are reserved for USB.