I2C on Mikromedia HMI 7" with breakout board

General discussion on mikroC PRO for FT90x.
Post Reply
Author
Message
mrpoons
Posts: 12
Joined: 18 Sep 2012 10:23

I2C on Mikromedia HMI 7" with breakout board

#1 Post by mrpoons » 08 Dec 2016 03:11

I am developing an application using the new Mikromedia HMI 7" display and the Mikromedia HMI breakout board. The application required that I get data from an I2C peripheral. I have implemented a number drivers for this peripheral in the past and have used them to confirm that the peripheral is working as expected.

I have implemented my code using the only FT90x example available. The I2C_Simple example for the EasyFT90x V7

I have initialized the I2C Module using

I2CM1_Init(_I2CM_SPEED_MODE_STANDARD, _I2CM_SWAP_DISABLE);

and read the device using

I2CM1_Set_Slave_Address(SLAVE_ADDRESS);
I2CM1_Write(0x01);
I2CM1_Read(rxData);

And nothing...

I have a scope attached to the I2C0_SCL and I2C0_SDA lines on the breakout board and I have nothing...

I can see that the library functions show...

I2CM1_XXXX

and the breakout board shows

I2C0 SCL and I2C0 SDA

The help files are confusing as they note

I²C library routines require you to specify the module you want to use. To select the desired I²C module, simply change the letter n in the routine prototype for a number from 0 to 5.

But there is no letter n in the routine prototype to change.

I was hoping someone from Mikromedia could answer a couple of questions...

Is there an I2C example for the Mikromedia HMI?

Does the I2C library functions which reference I2CM1 actually control I2C0 on the processor?

Thanks

Mike

User avatar
nadir.celebic
mikroElektronika team
Posts: 465
Joined: 15 Jun 2016 13:19

Re: I2C on Mikromedia HMI 7" with breakout board

#2 Post by nadir.celebic » 08 Dec 2016 18:04

Hi,

I will take a look in it, test it and let you know about the results.

Regards,
Nadir

mrpoons
Posts: 12
Joined: 18 Sep 2012 10:23

Re: I2C on Mikromedia HMI 7" with breakout board

#3 Post by mrpoons » 09 Dec 2016 00:53

Thanks, much appreciated

User avatar
nadir.celebic
mikroElektronika team
Posts: 465
Joined: 15 Jun 2016 13:19

Re: I2C on Mikromedia HMI 7" with breakout board

#4 Post by nadir.celebic » 09 Dec 2016 17:58

Hi,

Yes, I2CM1 in the code controls I2C0 on the MCU.
If you want to make mikromedia HMI as Slave, I recommend to use SPI Slave on MAIN Connector .

But, I will make a simple project for mikromedia HMI 7", which represents I2C function.

Regards,
Nadir

mrpoons
Posts: 12
Joined: 18 Sep 2012 10:23

Re: I2C on Mikromedia HMI 7" with breakout board

#5 Post by mrpoons » 11 Dec 2016 08:26

Thanks Nadir,

I am trying to make the Micromedia HMI the Master and my peripheral the Slave.

I have a scope on the I2C lines and don't see anything. I am clearly doing something wrong to initialize the I2C, and example would be much appreciated.

Mike

User avatar
nadir.celebic
mikroElektronika team
Posts: 465
Joined: 15 Jun 2016 13:19

Re: I2C on Mikromedia HMI 7" with breakout board

#6 Post by nadir.celebic » 12 Dec 2016 18:03

Hi,

Please, can you attach here the detailed photos of your hardware configuration ?
Also, you can attach here your project in zip.

Regards,
Nadir

mrpoons
Posts: 12
Joined: 18 Sep 2012 10:23

Re: I2C on Mikromedia HMI 7" with breakout board

#7 Post by mrpoons » 13 Dec 2016 00:10

Thanks Nadir,

I attached the project I created and a photo of the hardware. We are using the Micromedia HMI 7" display to show the status of a battery which includes a charging circuit and monitor. The Mikromedia HMI 7" Display is connected to a Mikromedia HMI breakout board which is in-turn connected to a shared ground and the SDA and SCL lines from the battery.

I have code running on a ARM Cortex M4 processor which reads the battery status properly using 12C.

I have connected a scope to the I2C0_SCL and I2C0_SDA lines on the breakout board and I don't see any communication from the processor.

I2CM1_Write() always returns _I2CM_STATUS_ERROR

Mike
Attachments
BatteryCharger.zip
(1.1 MiB) Downloaded 168 times
BatteryCharger.JPG
BatteryCharger.JPG (2.11 MiB) Viewed 5775 times

User avatar
nadir.celebic
mikroElektronika team
Posts: 465
Joined: 15 Jun 2016 13:19

Re: I2C on Mikromedia HMI 7" with breakout board

#8 Post by nadir.celebic » 13 Dec 2016 17:32

Hi,

For I2C communication you need some I2C module, in this case I used the EEPROM click
http://www.mikroe.com/click/eeprom/ and mikromedia HMI 5".
Please take a look on photo in attachment and try I2C example.

NOTE: If you don't have I2C module you will not get a signal on an oscilloscope.
Attachments
IMAG0209.jpg
IMAG0209.jpg (2.09 MiB) Viewed 5544 times
I2C Simple.zip
(110.7 KiB) Downloaded 189 times

Post Reply

Return to “mikroC PRO for FT90x General”