SCB_P4 component in CYBLE-022001-0 design

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

I have a custom board with a MMA8653FC accelerometer.

   

It has the I2C interface and the spec says that the address of the interface is 0x1D
I set up a SCP_P4 component as an I2C master 
Assigned SCL and SDA of the component to CYBLE  according to the board schematic, SCL to pin 19 and SDA to pin 18
I'm getting a Accel_I2C_MSTR_ERR_LB_NAK error in Accel_I2CMasterSendStart routine 
Also board schematic shows that INT1 and INT2 from the accelerometer are assigned to pins 6 and 9 of the CYBLE-022001-0.
I don't know how to do that in PSoC creator. 
Your help is much appreciated.

   

Project is attached

   

Thanks

   

Andy

0 Likes
1 Solution
Anonymous
Not applicable

Duh. I forgot to add CyGlobalIntEnable..

   

It's working now.

   

On to the next problem 🙂

   

Thanks for your  help!

   

Andy

View solution in original post

0 Likes
9 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Usual questions: Pullup resistors on SDA and SCL? VDDIO tied high?? Component initialized using I2C_Start() API???

   

 

   

Bob

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

#1 Yes

   

#2 Don;t know how to tell from the schematic. Pretty sure it is. The spec says so

   

Attached is the part of the schematic where VDDIO is mentioned

   

Sorry can't divulge any more due to IP restrictions

   

#3 The code calls  a generated routine Accel_Start() routine

   

The comment there says " After this function call, the component is enabled and ready for operation."

   

So I'm pretty sure the answer is yes

   

Also what about the INT1 and INT2?

   

On the schematic they are shown to be assigned to pins 6 and 9 of the CYBLE.

   

How do I connect them in PSoC?

   

Thanks

   

Andy

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

We come to the "INT1" and "INT2" later (probably pure input pins, may get configured to interrupt the PSoC)

   

At first you should get the I2C to work. Verify in Creator pin view that the ports P1[5] and P1[4] are connected to scl and sda respectively.

   

For testing purposes: use

   

Set compiler optimization to "none"

   

CyGlobalIntEnable;

   

Accel_Start();

   

Status = Accel_I2CMasterSendStart(0x1d,1);

   

Accel_I2CMasterSendStop();

   

and check Status for non-zero (error).

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Duh. I forgot to add CyGlobalIntEnable..

   

It's working now.

   

On to the next problem 🙂

   

Thanks for your  help!

   

Andy

0 Likes
Anonymous
Not applicable

Would appreciate some help setting up the INT1 and INT2 pins..

   

Thanks 

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

You may read the INT pins directly and act upon in software, so just configure the pin as digital input,high Z, no hw connection.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Is there a sample code/project you can point me to?

   

Sorry for newbie questions

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

The INTn pins function of the accelerometer are programmable, so it is up to you to decide whether you need them and if, what event is connected to them. Clearing the line on the 8653 must be done which needs some effort.

   

It is your decision as well, to select on PSoC side between a polled (frequently checked) input or an interrupt raised. I would start with a polled input: Setup the pins as I described in my previous post, then in the main loop check the pins using Pinname_Read() API (see pin documentation) and act accordingly as:

   

    if(INT1_Read()) HandleInt1();    //  INT1 pin was raised, clear interrupt and do the job

   

 

   

Bob

Anonymous
Not applicable

Thank you Bob,your help is much appreciated.

0 Likes