⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
4 posts / 0 new
Last post
Evan XUAN
Offline
Last seen:2 years 1 month ago
Joined:2019-03-30 12:57
DA14580 connect to DS18B20

Hi,

I am trying using theDS18B20connect to a GPIO pin of the DA14580 to measure temperature. The DS18B20 uses Maxim’s exclusive 1-Wire bus protocol that implements bus communication using one control signal. I have implemented it in a basic project that only include basic GPIO file and Successfully read temperature. I need to use the timer to control DA14580 to read the temperature in every 5s and send it to another device by Bluetooth.My problem isthe temperature measuring didn't work when I copy my code to the SDK project that can achieve timer function. Considering the DS18B20 requre very strict timing, I tried to disable the IRQ. But it didn't help. I have reserved the pin connected to DS18B20. I'm really confuse now. Looking forward to your help and sorry about my baddly English.

Thank you

Device:
PM_Dialog
Offline
Last seen:2 days 1 hour ago
Staff
Joined:2018-02-08 11:03
Hi Evan XUAN,

Hi Evan XUAN,

>> My problem is the temperature measuring didn't work when I copy my code to the SDK project that can achieve timer function.

Could you please clarify your question? Which SDK project are you using and which version of SDK? Did you run your code in debug mode in order to check if your firmware gets stuck? Are you using any of BLE projects which implement any of sleep modes?

同时,请注意,我们有一个非常相关的软件e example for DA14585/6 product family and it is based on our new SDK6! Please have a look at this example:

SW Example: 1Wire using DS18B20 temperature sensors

This SDK6 DA14585 example provides an implementation of a 1-Wire driver with three DS18B20 sensors (editing the MAX_NO_SENSORS value in the one_wire.h file will allow more sensors to be connected). The 1-Wire commands and sensordata are added in BLE characteristics to be controlled or read from a smartphone application (i.e. Lightblue for iOS or BLE Scanner for Android).

Thanks, PM_Dialog

Evan XUAN
Offline
Last seen:2 years 1 month ago
Joined:2019-03-30 12:57
Hi,

Hi,

I'm using the SDK 5.0.4 and the project is ble_app_barebone. I had run my code in debug mode, everything was good except the value of the temperature. The value I read was about 300℃ which is over the range of DS18B20. I don't know how to control sleep mode and how it effect DS18B20. But I read the example you gave me today, it's a different way that using SPI to control the 1 wire bus. But I stil have some question: I saw it connect the Tx pin to the SPI MOSI pin(P0_6) and the Rx pin to P1_3, does the P1_3 has any special function or it just a normal GPIO pin ? How does it control the timing when DA14585 communicate to DS18B20 through the SPI ? If I don't have the diode to prevent the Tx pin, would it work? By the way, do you have any example about LM75A? I failed to use it in DA14580 board too. Maybe you can read my code.

Attachment:
CYibin
Offline
Last seen:8 months 3 days ago
Staff
Joined:2017-12-14 02:48
Hi Evan,

HiEvan,

I've read your code and find there are so much delay, which may cause system cruashing. It's better to separate the time by using a state mechine.

Br

CYibin