I'm running launchxl-cc2650 on contiki to read temperature and humidity value from dht11 sensor. build with contiki, and flash with ti programmer 2. But my board can't seem to read the value of the sensor (output reading timed out) i'm trying on 2 difference board and 2 sensors (same type) so i'm pretty sure the problem didn't come from hardware, and the led from sensor light up which mean it has power. This code has been run succesfully by my senior last year. so it really confuse me of which could cause the problem, the plug the data to IOID_0 Pin. The code could be found at contiki-ng/dht11.c at develop · contiki-ng/contiki-ng (github.com) with a little twist i made, code be written below. The only different thing from my senior is that when i build using make command, it only result in .elf file, not the .hex and .bin file. Could this be the problem? i think it's unlikely cause Ti Programmer 2 support .elf file, and i have been flashing succesfully with .elf file with other examples. Plese lend me your though.
#include "contiki.h"
#include <stdio.h>
#include "board.h"
#include "dht11-sensor.h"
/*---------------------------------------------------------------------------*/
PROCESS(dht11_process, "DHT 11 process");
AUTOSTART_PROCESSES(&dht11_process);
/*---------------------------------------------------------------------------*/
#define DHT11_GPIO_PORT (1)
#define DHT11_GPIO_PIN (12)
#define BOARD_IOID_DIO0 IOID_0
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(dht11_process, ev, data)
{
static struct etimer timer;
PROCESS_BEGIN();
dht11_sensor.configure(DHT11_CONFIGURE_GPIO_PIN, IOID_0);
dht11_sensor.configure(SENSORS_HW_INIT, 0);
/* Wait one second for the DHT11 sensor to be ready */
etimer_set(&timer, CLOCK_SECOND * 1);
/* Wait for the periodic timer to expire */
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&timer));
/* Setup a periodic timer that expires after 5 seconds. */
etimer_set(&timer, CLOCK_SECOND * 2);
while(1) {
/*
* Request a fresh read
*/
SENSORS_ACTIVATE(dht11_sensor);
switch(dht11_sensor.status(0)) {
case DHT11_STATUS_OKAY:
printf("Do Am : %d.%d %% \n",
dht11_sensor.value(DHT11_VALUE_HUMIDITY_INTEGER),
dht11_sensor.value(DHT11_VALUE_HUMIDITY_DECIMAL));
printf("Nhiet Do : %d.%d *C\n",
dht11_sensor.value(DHT11_VALUE_TEMPERATURE_INTEGER),
dht11_sensor.value(DHT11_VALUE_TEMPERATURE_DECIMAL));
break;
case DHT11_STATUS_CHECKSUM_FAILED:
printf("Check sum failed\n");
break;
case DHT11_STATUS_TIMEOUT:
printf("Reading timed out\n");
break;
default:
break;
}
/* Wait for the periodic timer to expire and then restart the timer. */
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&timer));
etimer_reset(&timer);
}
PROCESS_END();