- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hello there,i am interfacing adxl345 with CY8CKIT-042-BLE kit. i have uploaded my main.c and main.h file here. can you tell me where i am doing mistake??
Solved! Go to Solution.
- Labels:
-
BLE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Usinf I2C master component, addressing the adxl345 as slave with address 0xd1.
sendstart()
writebyte() write register address 0x32
sendRestart()
readByte() 5 times with ACK, last time with NAK
sendstop()
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i have also question if i want to read 6 bytes from 0x32 location. how to read it??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Usinf I2C master component, addressing the adxl345 as slave with address 0xd1.
sendstart()
writebyte() write register address 0x32
sendRestart()
readByte() 5 times with ACK, last time with NAK
sendstop()
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ok my adxl345 address is 0x53/ i have done in my code. but i am not getting data
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
this code is not working. can you tell me why??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I do not believe that the I2C address is 0x53. The datasheet tells 0x32. Post a link to datasheet with a different address, please.
Can you please post your complete project, so that we all can have a look at all of your settings? To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
https://www.sparkfun.com/datasheets/Sensors/Accelerometer/ADXL345.pdf in this data sheet , page 10 says that slave address is 0x53. i have also used adxl345 with another microcontroller with 0x53 address.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So you are using the alternate I2C address, how should one know... But better check that!
Some general hints: a .h file usually contains declarations only, no definitions at al. Thus, a .h file does not allocate or use any memory, neither flash nor ram. So your main.h contains programs, which you should avoid. Have a look at the Cypress generated .h and .c files and how they communicate. look at the #if !defined or #ifndef conditional compilation at the beginning of the .h. This allows to #include them into several different files within a project.
You are using
uint8 buffer_i2cy[1] ={0x33} ;
I2C_I2CMasterSendStart(ADXL375_ADDR , I2C_I2C_WRITE_XFER_MODE);
I2C_I2CMasterWriteByte(buffer_i2cy[0]);
Better will be
Status = I2C_I2CMasterSendStart(ADXL375_ADDR , I2C_I2C_WRITE_XFER_MODE);
Status |= I2C_I2CMasterWriteByte(0x32);
Status |= I2C_I2CMasterSendRestart(ADXL375_ADDR, I2C_I2C_READ_XFER_MODE);
x = I2C_I2CMasterReadByte( I2C_I2C_ACK_ADDR );
x1 = I2C_I2CMasterReadByte( I2C_I2C_NAK_ADDR );
Status |= I2C_I2CMasterSendStop();
and check the status variable in debugger for != 0 which indicates an error.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hello there i followed your guidelines.but it didn't work for me. now
(1)i am working with CY8C4247LQI-BL483 kit. i am trying to interface sparkfun adxl345. it is not working for me
(2)i tried to interface sparkfun bmp180 with CY8C4247LQI-BL483. it works fine
(3) i interfaced sparkfun adxl345 with CYBLE-022001-EVAL. it works fine
now problem is between CY8C4247LQI-BL483 and sparkfun adxl345.
can anyone tell me?? what is solution of this??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You said in the post above that you had it working with the CYBLE-022001-EVAL. So take that project, and use the Device Selector from the Project Menu and change the device to CY8C4247LQI-BL483. Change the Pin assignments for I2C if needed, then build and program and it should work fine.
I do this all the time without issues.
/edit: spelling fixes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you had it working with the CYBLE-022001-EVAL, all you should have had to do was use the device selector and change devices to the CY8C4247LQI-BL483 and you would be done. Well, I would check that the pins are still assigned how you wanted them, but otherwise code would have been the same.
I have used both PSoC and PRoC to interface to an MMA8451Q and this is all I have had to do to change between boards. (I have several homemade boards with different devices I use for testing code and design changes, so I am doing this all the time...)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i have already selected device CY8C4247LQI-BL483. otherwise code can't fuse in devices. iam facing this problem in adxl345. i have also used mma8451Q. its working fine for me
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Have you gotten this to work yet? If not, post your project and I will test on my hardware. I have the sparkfun module you are using.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @andreacassigoli @Bob_Marlowe @DaBr_1233126
I retrieved the above project and executed it, where my x,y, and z values do not change when I move the adxl345 sensor.
Could you Check my code? and tell me where I made a mistake because the x,y, and z values are not changing when I read from registers, Where I change the position of my sensor. once Check the flow where I made a mistake in I2C,
PFA of the project.