Posted: Sun Mar 18, 2012 9:36 pm Post subject: Problem with I2C (hangs with I2cwbyte)
Hi,
my program hangs up when trying to send data via I2C to HMC5843 Magnetometer. (whole code is attached)
Code:
...
' Konstanten für die Ansteuerung von HMC5843 Const Hmc_write =&H3C
Const Hmc_read =&H3D
' Variablen Dim Grad AsInteger Dim Bgrad AsByte
' Hauptprogramm
Led =1
Zeige7seg 10 I2cinit
Zeige7seg 20
' Setze IC in Continous Modus I2cstart
Zeige7seg 30 I2cwbyte Hmc_write
Zeige7seg 40
...
The line Zeige7seg 30 is executed but not the line Zeige7seg 40 . After executing I2start Err is 0. I wonder what leads to this hang up without any error code. Do you have an idea? Btw: I also tried without I2cdelay
I do not see anywhere in the code the required startup delay, as given by the data sheet:
Quote:
To change the measurement mode to continuous measurement mode, after the 8.3 milli-second power-up time send the three bytes
Also stack and frame settings are missing, then the setting from the IDE are used, which will not necessarily be sufficient.
Also be aware that soft-I2C needs external pullups, while hard-I2C may work with the µC's internal ones.
In the datasheet they mentioned that the pullups are integrated - but this seems not to be enough!
Well it reads differently.
Quote:
Depending on the application, the internal pull-ups may be used to support slower data speeds than specified by I2C standards.
And:
Quote:
This device shall support standard and fast modes, 100kHz and 400kHz respectively, ... External pull-up resistors are required to support these standard and fast speed modes.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum