I am trying to interface a temperature sensor (LM73) to a GL865 via the I2C bus.
Is it more advisable to use:
1. AT commands (AT#I2CWR and AT#I2CRD), or 2. the IIC built-in module?
I find the description of the IIC built-in module in the "Easy Script in Python" manual quite fuzzy, even with some misprints. And there are a number of commands described and then commented "we suggest to use…" – well – some other command. Makes me a bit confused.
Any proven examples available somewhere?
AT#I2CWR and AT#I2CRD are working perfectly on GE865 pins GPIO 9 and 10 (with internal pull-up resistors).
In GL865 these pins are missing, so put pull-up resistors to POWERMON and try.
Nikolay, many thanks for your encouragement! I will now start by trying these AT commands. And special thanks to you about reminding me of those pull-ups. I would probably have spent a few hours in vaste before hitting on an idea of missing resistors.
I am new to GL865, played with GE865 before. And having a new I2C circuit along (LM73) as well, I will surely have to struggle with some peculiarities of this circuit anyway, so less known problems from start is very welcome 🙂
Regarding I2C on GL865, I have progressed slightly. But please, what is hidden behind OK and ERROR results, with the AT#I2CRD command? The AT command manual says nothing (as usual) about the reasons for ERROR, or the prerequisites for OK.
Some examples from my setup:
at#i2crd=3,4,048,07,1 [wrong address 048. Addr. must be shifted left by one bit.]ERROR
at#i2crd=3,4,090,07,1#I2CRD: 00OK [now something happens, but the result is not as expected]
at#i2crd=4,3,090,07,3 [SCL and SDA lines inverted, by purpose -> ERROR]ERROR
So when and if I get OK as the response, what has happened sofar?
apart the syntax error of comamnd which is not the case now, you get an ERROR in case of a missed ACK from IIC device while reading or writing. And this is your case when you switch te GPIO or you use a wrong address.
For the unexpected reading 0x00 it’s strange. Module communicate correctly since you get the ACK( otherwise you’ll fall in the other condition and get ERROR). For tjhe reason whythe reading is not as expected, why you say so? can you check hte line with an oscilloscope?
Luca, thanks for your answer. Good news seems to be that with some combination I manage to get "OK", indicating an ACK from the external chip. "OK" should not appear by random, I think.
"Unexpected" means that I was supposed to read a constant value, from a read-only Chip Identification Register, that should always respond by 0190h, not 0000h.
But this external I2C chip, National Semiconductor LM73 is a bit complex. It has an internal pointer register that I should first manage to control.
Are there available any timing diagrams of the AT#I2CRD and AT#I2CWR commands?
I do not currently know what to put into the AT command field named <registerId>, since I should use the internal pointer register of the LM73 circuit.
Well, wrapping up my sleeves and grabbing an oscilloscope, that should be my last resort…if logical reasoning wo’nt help at all.
The command AT#I2CRD=8,9,30,0,2 used to read from a device I have here with Device addrr 0x30 and starting from internal address 0x00 give me this sequence on HW lines:
first I see a write operation with value 0x30 followed by the value 0x00. Than the 0x31 (read from 0x30 ) is send and following I can read 2 bytes.
Attached some snapshots of lines .. I hope can help
Hit enter to search or ESC to close
Knowledge Base & Download Zone