View previous topic :: View next topic |
Author |
Message |
russk2txb
Joined: 30 Mar 2008 Posts: 109 Location: New Jersey
|
I2C on schmidt trigger inputs? |
Posted: Wed Oct 12, 2016 6:44 am |
|
|
Will software i2C master work on the RE1 and RE2 lines of a 18F4682? I never tried to use them before but the new board I am working on has them set up that way. Apparently able to address the temp chip (DS1631) but always returns FF values. Maybe it is a bad temp chip but thought I'd ask before changing chip.
Thanks, Russ |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19552
|
|
Posted: Wed Oct 12, 2016 7:13 am |
|
|
Technically I2C, actually wants Schmitt inputs!...
You can get away with CMOS, and in some cases, people 'cheat' using 3.3v I2C devices to talk to a 5v chip, by using CMOS inputs (the Schmitt won't work without a buffer).
Now, 'FF', says the line is being permanently seen as high, so the device is not responding. Are you sure you are addressing the device correctly?. Try PCM_Programmer's I2C scanner program (in the code library), and see if you get a response at any address.
The 1631, is at address 0b1001 A2A1A0x Where 'x' is 1 for read, and 0 for write.
0x90/0x91 if you have all three address lines held low. Beware of the 7bit versus 8bit address confusion (they tell you it's 7bit address, but the PIC uses 8bit address format, so you have to multiply by 2).
Make sure you have disabled the comparators, analog, and the PSP on these pins. |
|
|
russk2txb
Joined: 30 Mar 2008 Posts: 109 Location: New Jersey
|
|
Posted: Wed Oct 12, 2016 7:40 am |
|
|
Thanks for the quick reply. Yes the address lines are all low and am using 0x90/91 to address the chip. Think I have everything disabled: Code: | setup_ccp1 (CCP_OFF);
setup_ccp2 (CCP_OFF);
setup_adc_ports (AN0_TO_AN5);
|
The E1 / E2 lines are AN6 and 7, so the adc should be disabled. I am using software i2c with the DS1631 on many other projects with no problems. The only difference here seems to be the use of port E. Also using a new version of the CCS compiler (version 5.064). Previously was using 5.062 and I doubt there is any change to I2C code between them.
Thanks again, Russ |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19552
|
|
Posted: Wed Oct 12, 2016 8:01 am |
|
|
add
setup_psp(PSP_DISABLED);
If you are using the same chip elsewhere, then you know the likely problems of needing to wake it up etc.. What are you using as pullups?. On the ST inputs, or on hardware I2C, you will need to ensure that the pullups are more aggressive than may be needed for standard inputs. |
|
|
|