- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Solved! Go to Solution.
- Labels:
-
BLE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Duh. I forgot to add CyGlobalIntEnable..
It's working now.
On to the next problem 🙂
Thanks for your help!
Andy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Usual questions: Pullup resistors on SDA and SCL? VDDIO tied high?? Component initialized using I2C_Start() API???
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
#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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Duh. I forgot to add CyGlobalIntEnable..
It's working now.
On to the next problem 🙂
Thanks for your help!
Andy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Would appreciate some help setting up the INT1 and INT2 pins..
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is there a sample code/project you can point me to?
Sorry for newbie questions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you Bob,your help is much appreciated.