Announcements
IMPORTANT: Cypress Developer Community is transitioning on October 20th. To learn more and be prepared for this change, check out our latest announcement.
cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 6 MCU

RoNe_950711
New Contributor II

Hey Everyone,

I've found something interesting with the i2c master mode on the PSoC 6 early access board:

Below you can see a i2c communications snapshot between a temperature sensor and one of my older devices:

working.jpg

With the PSoC 6, i'm trying to use that same hardware for an iot weather station application, here is that communication snapshot:

notworking.jpg

As you can see, shortly after the start, i'm not getting an acknowledge from the slave (ignore the restart/2nd read, i was trying to force a re-read)

Here is a very simplistic version of my i2c call's i'm trying to do:

#include "I2C_1.h"

int main(void)

{

uint8_t temp=0;

    __enable_irq(); /* Enable global interrupts. */

   

    I2C_1_Start();

    for(;;)

    {

        I2C_1_MasterSendStart(0x40, CY_SCB_I2C_WRITE_XFER, 200);

        I2C_1_MasterWriteByte(0xF5, 200);

        I2C_1_MasterSendReStart(0x40, CY_SCB_I2C_READ_XFER, 200);

        I2C_1_MasterReadByte(CY_SCB_I2C_NAK, &temp, 200);

        I2C_1_MasterSendStop(200);

/* breakpoint */

        CyDelay(500);       

    }

}

Originally in the TopDesign, i didn't define the pin's in the I2c module.  One of things I later changed and didn't see much affect (other than less noise on SDL). Both are now defined as Bidirectional, resistive pull-up and i2c fm (400kbps) (the screen shot above is with that mode setup) (Pin's P6[0] and P6[1])

I'm using the June release of the PSoC Creator build for PSoC 6 linked to in this forum.

Regards,

0 Likes
1 Solution
RodolfoGL
Employee

Hello, I was able to use your code to successfully connect with an I2C slave. Here is the screenshot. (Only changed the I2C slave address).

Capture.PNG

Are you sure your slave is connected to the bus?

View solution in original post

0 Likes
2 Replies
RodolfoGL
Employee

Hello, I was able to use your code to successfully connect with an I2C slave. Here is the screenshot. (Only changed the I2C slave address).

Capture.PNG

Are you sure your slave is connected to the bus?

View solution in original post

0 Likes
RoNe_950711
New Contributor II

Thanks Rlos for your reply and confirmation on the code snip-it.  We have success now!

i2cmaster.PNG

Sadly, the PSOC 6 arduino header isn't 100% compatible.  On the shield I was planning to use, (it's got 4 nice weather sensors), I lifted A4/A5 so the i2c bus wouldn't be affected by pins 10.4/10.5 on the psoc, along with shorting 5.0v to 3.3v and lifting 5.0v on the shield (so internally it's now just running at 3.3v).  While this works on a 3.3v arduino, no luck here.

So today i switched to just using one of the same i2c sensor's running at 3.3v, with a very simple 4 wire break out board (scl/sda/gnd/vcc), it just works fine.

Regards,

Top labels