Moreaover, I will never change the pinMode I let that I2C protocol change the state of the pin in OUTPUT_OPEN_DRAIN without my command on the sketch.
I2C Maple with AM2315 (Temperature and Humidity sensor)
(19 posts) (6 voices)-
Posted 2 years ago #
-
ventosardegna - "I will try to use another board, maybe I've fried the Maple using non 5V-tolerant ports.."
If you haven't got another board handy, you could test the pins using the board itself.
Start with something like the Maple IDE example programs Blink, and a LED, button and a couple of 1K resistor (which should be enough to turn the LED on, and big enough to be easy to pull up or down).
Test the non-5V tolerant pin 4 to see that it is okay. Check 5V tolerant pins with a 5V supply and use the button or a second pin to create a test signal.Posted 2 years ago # -
Ok thanks gbulmer, tests are OK, i don't have fried the board. I still cannot reach the oscilloscope (maybe tomorrow I hope..)
You asked me what version of Wire (soft) library I use.
I have tried 2 versions:a) wire library included in the IDE
b) wire library provided by ala42: http://home.arcor.de/ala42/Wire.zipboth with no luck.
Posted 2 years ago # -
Hi,
for those who still need help with interfacing the AM2315, I eventually succeeded.
Here is the recipie.1) perform the changes by elstonj :
- http://forums.leaflabs.com/topic.php?id=1145
Next
2) include a special function to wake up the sensor :
Wire.beginTransmission( ADRESSE_AM2315 ) ;
i2c_start(port);
i2c_shift_out(port, (ADRESSE_AM2315 << 1) | I2C_WRITE);
i2c_send_ack(port) ;
vTaskDelay( DELAY(2) ) ; // Or equivalent, to hold the lines from 800 µs to 3 ms
i2c_stop(port);3) Include the delays requested by the manufacturer
vTaskDelay(DELAY(1));
Wire.beginTransmission( ADRESSE_AM2315 ) ;
Wire.send( AM2315_READREG ) ;
Wire.send( AM2315_ADRREG ) ;
Wire.send( AM2315_NB_BYTES ) ;if ( Wire.endTransmission() == SUCCESS )
{
vTaskDelay(DELAY(3));
n = Wire.requestFrom( ADRESSE_AM2315, AM2315_NB_BYTES ) ;
vTaskDelay(DELAY(1));
if ( n == AM2315_NB_BYTES )
{
n = Wire.receive() ; // Last Command
n = Wire.receive() ; // Byte number
Hamb = ( Wire.receive() << 8 ) ; // 1st data byte
Hamb += Wire.receive() ; // 2nd data byte
Tamb = ( Wire.receive() << 8 ) ; // 3rd data byte
Tamb += Wire.receive() ; // 4th data byte
}
}4) Please note that :
- The nb of bytes must be 6 : Command, Nb bytes, and the four bytes of the data
- The sensor I2C address is actually 0x5C and not 0xB8 as you can read in the documentation.Hope this will help !
I wish someone could update the libraries in the repository. This holds true also for the bxCAN library for Olimex boards.
Posted 1 year ago #
Reply
You must log in to post.