Forums

Urgent help on pic24f16ka102 and mag3110 sensor using i2c

Started by T Obulesu July 1, 2018
Hi..
Can some one please help me on writing the i2c code just to read the mag3110 sensor data using the pic24f16ka102?

I struggled a lot to implement my own i2c library for the fxos8700cq and somehow i got it work. And I don't want to use all the functions in I2C (Except i2c init, read, write, start, stop).
But the same library is not working for the mag3110 and am in desperate need of it.

So please help me on at least reading the WHO_AM_I register of the mag3110 sensor using pic24f16ka102 and how to set the active and idel mode of the sensor?
On Sunday, July 1, 2018 at 7:29:29 AM UTC-4, T Obulesu wrote:
I'm not terribly familiar with the PIC24F.
That said, when people run into problems with I2C, it is often the case that the bus is being released (end of read or write) before a multi-byte transaction is complete. 

I forget the exact compiler or library when a colleague had a similar issue recently, but there was both a "write" and a "write word" choice, or something like that.  Basically, one subroutine would send a single byte and release the I2C bus.  The other choice would allow for multiple byte transfers before releasing the bus. Obviously, releasing the bus prematurely is going to be a problem!

Another quirky I2C issue can be found here:
https://thewanderingengineer.com/2015/05/02/1312/

Good luck, and sorry could not be of more help..
On Sunday, 1 July 2018 19:14:45 UTC+5:30, mpm  wrote:
> On Sunday, July 1, 2018 at 7:29:29 AM UTC-4, T Obulesu wrote: > I'm not terribly familiar with the PIC24F. > That said, when people run into problems with I2C, it is often the case that the bus is being released (end of read or write) before a multi-byte transaction is complete. > > I forget the exact compiler or library when a colleague had a similar issue recently, but there was both a "write" and a "write word" choice, or something like that. Basically, one subroutine would send a single byte and release the I2C bus. The other choice would allow for multiple byte transfers before releasing the bus. Obviously, releasing the bus prematurely is going to be a problem! > > Another quirky I2C issue can be found here: > https://thewanderingengineer.com/2015/05/02/1312/ > > Good luck, and sorry could not be of more help..
Thanks for your swift response.. Came to know that there are many victims of this issue... Anyway... If anyone could let me know the small function/ code on: How to initiate the I2C read data write data stop I2c idle I2C without using the library and considering the mag3110 would be more helpful.....