Does BW16 support one wire communication?

I tried to get temperature value from DS18b20 on my BW16 board. But I can’t get any useful value from sensor. I cannot find any example of using DS18b20 with RTL8720DN on the Internet.

Here is my code:

/********************************************************************/
// First we include the libraries
#include <OneWire.h> 
#include <DallasTemperature.h>
/********************************************************************/
// Data wire is plugged into pin 2 on the Arduino 
#define ONE_WIRE_BUS  2
/********************************************************************/
// Setup a oneWire instance to communicate with any OneWire devices  
// (not just Maxim/Dallas temperature ICs) 
OneWire oneWire(ONE_WIRE_BUS); 
/********************************************************************/
// Pass our oneWire reference to Dallas Temperature. 
DallasTemperature sensors(&oneWire);
/********************************************************************/ 
void setup(void) 
{ 
 // start serial port 
 Serial.begin(115200); 
 Serial.println("Dallas Temperature IC Control Library Demo"); 
 // Start up the library 
 sensors.begin(); 
} 

void loop(void)
{

float temperature; 

sensors.requestTemperatures();  
temperature = sensors.getTempCByIndex(0);  
Serial.println(temperature);
delay(1000);

}

Thanks.

1 Like

Hi @adadadd

Please check out this link @

Please note that, some modifications are to be done to be compatiable with BW16 at line 254 of the OneWire.h file

Thanks for your advice.

But I would like to ask more detail about it. Is that mean I should modify the content inside?

What I have done is:

#define DIRECT_MODE_INPUT(port, mask)   ( *( (volatile uint32_t *)( 0x48014050 + ((uint32_t)port) * 0x400 ) ) &= ~mask )
#define DIRECT_MODE_OUTPUT(port, mask)  ( *( (volatile uint32_t *)( 0x48014000 + ((uint32_t)port) * 0x400 ) ) |=  mask )

Is there any more I should modify?

Thanks.

1 Like