⚠️
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.
9 posts / 0 new
Last post
prasanth.velliy...
Offline
Last seen:1 year 11 months ago
加入:2016-02-18 12:18
DHt11_driver

Hi Dialog Team

i want to use DHT11 snesor driver in sdk 5.0.4 ,
i tried using this driver but not working , do i have to select port pins ??what all are the modifications i have to do ? so i can read from sensor ??

//systick_usec_units(true); i just commented this line , is there are other option ??

Thank you Dilaog.

Device:
MT_dialog
Offline
Last seen:2 months 3 weeks ago
Staff
加入:2015-06-08 11:34
Hi prasanth.velliyangiri,

Hi prasanth.velliyangiri,

I am sorry i dont get the question as far as i could check the DHT11 is a somekind of a temperature sensor but i am not able to see the interface that it is using, analog digital, so you can either use the SPI or the I2C drivers in order to communicate with the sensor if it has a digital interface or use the ADC if it is analog. I dont understand what a systick function which is not part of the SDK as far as i can tell has to do with it.

Thanks MT_dialog

prasanth.velliy...
Offline
Last seen:1 year 11 months ago
加入:2016-02-18 12:18
Hi Dialog

Hi Dialog

Thank you for your reply

in sdk5.0.4 SDK 5.0.4/DA1458x_SDK_5.0.4/DA1458x_SDK/5.0.4/sdk/platform/driver/sensor/dht11

this is the driver i am mentioning , i hope this is developed by dialog

thank you

prasanth.velliy...
Offline
Last seen:1 year 11 months ago
加入:2016-02-18 12:18
Hi Dialog

Hi Dialog

systick_usec_units(): Selects the core clock at 16 MHz (with a tick duration of 62.6 ns) or the
reference clock at 1 MHz (with a tick duration of 1 s) as the clock source for the SysTick timer.

if systick_usec_units() is not part of sdk , then how can i select reference clock to 1MHZ

usec
Selects the SysTick clock frequency.
TRUE: use the reference clock frequency of 1 MHz
FALSE: use the core clock frequency of 16 MHz

谢谢你的对话框

MT_dialog
Offline
Last seen:2 months 3 weeks ago
Staff
加入:2015-06-08 11:34
Hi prasanth,

Hi prasanth,

Hadn't seen the driver for that particular sensor, its not used in any of our examples so i missed it.

不管怎样正确使用我t you will have to first to configure your pin that you connent the single bus output of your sensor like this GPIO_ConfigurePin(DHT11_GPIO_PORT, DHT11_DATA_PIN, OUTPUT, PID_GPIO, true) then initialize with the init function void DHT11_Init(GPIO_PORT port, GPIO_PIN pin, IRQn_Type irq) and then by using the DHT11_Status_t DHT11_Read(BYTE*, BYTE*); you can start reading back data.

Thanks MT_dialog

prasanth.velliy...
Offline
Last seen:1 year 11 months ago
加入:2016-02-18 12:18
Hi Dialog

Hi Dialog

\DA1458x_SDK_5.0.3\DA1458x_SDK\5.0.3\projects\target_apps\peripheral_examples\systick\Keil_5

Inside the sdk i made the below changes
GPIO_ConfigurePin( GPIO_PORT_0, GPIO_PIN_0, OUTPUT, PID_GPIO, false );

int main (void)
{
uint8_t* tem ; uint8_t* hum;
system_init();
periph_init();
//systick_test();
int i = 0xBFFF ;
while(i--){
dht11_init(GPIO_PORT_0 , GPIO_PIN_0 , GPIO0_IRQn);
dht11_read( tem, hum);
}
in dht11.c

i commanded the
//systick_usec_units(true);

but still i am not able to read from sensor

my sensor has 10k pullup , Vcc = 5v , Gnd = GND , D = P0_0 ,

if (dht11_bit_get() < 1)
return dht11_reset(DHT11_FAIL); i am always getting DHT11_FAIL ...??

Please help me to resolve this..

MT_dialog
Offline
Last seen:2 months 3 weeks ago
Staff
加入:2015-06-08 11:34
Hi prasanth,

Hi prasanth,

Please try using the below function in order to test the sensor:

void dht11_test(void) { BYTE temperature, humidity; dht11_status_t response; printf_string("\n\r\n\r****************"); printf_string( "\n\r* DHT11 TEST *"); printf_string( "\n\r****************\n\r"); dht11_init(DHT11_GPIO_PORT, DHT11_DATA_PIN, GPIO3_IRQn); while ((response = dht11_read(&temperature, &humidity)) == DHT11_BUSY); if (response == DHT11_FAIL) printf_string("\n\rCould not read temperature & humidity!"); else { printf_string("\n\rTemperature: "); printf_int(temperature); printf_string("oC, Humidity: "); printf_int(humidity); printf_string("%RH"); } }

Thanks MT_dialog

prasanth.velliy...
Offline
Last seen:1 year 11 months ago
加入:2016-02-18 12:18
Hi Dialog

Hi Dialog

Thank you for your help.Now i am able to get data.
i made mistake in dht11_init(DHT11_GPIO_PORT, DHT11_DATA_PIN, GPIO3_IRQn); , now its working, thank you

MT_dialog
Offline
Last seen:2 months 3 weeks ago
Staff
加入:2015-06-08 11:34
Hi prasanth,

Hi prasanth,

If the answer was helpfull please mark it as accepted.

Thanks MT_dialog