- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to take an external interrupt from ADXL345 to PSoC4 BLE board.
I've configured everything and but I'm getting no Interrupts from the Accelerometer.
However, whenever I remove the wire connecting the Interrupt pin to the PSoC board, It gives me the interrupt continuously.
I've assigned Red LED when board sleeps and Blue when it wakes up. When I pull the connecting wire out, It flickers rapidly.
I'm not sure whether it's a problem in the accelerometer configuration or the PSoC interrupt configuration.
(I've checked the functioning of Accelerometer in the Arduino IDE, all interrupts work fine there {Inactivity, Activity, Tap, FreeFall etc}. But I don't know how to copy that IDE's code as a C or Header File)
PFA Project (Workspace has too many other projects, It's size is too big)
Regards,
Viraj
EDIR :- Spellings and an Update
Solved! Go to Solution.
- Labels:
-
BLE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Some of the Cypress kits (I am not aware which one you have got) can be switched from 5V operation to 3.3V. You need to run at 3.3V
Check with a logic analyzer the interrupt input to the PSoC
The error checking function as I implemented as an example unburdens you from all the queries of the "commStatus" variable. In practice you can put a "Blink red sign" or something similar to show that it is not working or even issue a CySoftwareReset() API.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You need to clear the interrupt in the ADXL345 by reading register 0x30.
You already wrote a readbyte() and writebyte() function, expand to a readword(). Leave the error handling within those routines. Call an I2C_Error() function and set a breakpoint there. Then your complete program will look a lot cleaner.
Use Project -> Update Components.. once, there are old component versions in your project.
Are you running your PSoC board at 3.3V?
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've used this code now, and I'm calling it right after I read from the accelerometer
void MonitorINT_SOURCE(void) {
/* Here 0x80 means DATA_READY, while 0x10 means ACTIVITY INTERRUPT */
uint8 accRegValue;
Accelerometer_RegRead(INT_SOURCE, &accRegValue);
if (((accRegValue&0x80) == 0x80) && ((accRegValue&0x10) != 0x10)) RED_Write(0);
else if ((accRegValue&0x10) == 0x10) GREEN_Write(0);
else {
RED_Write(1);
GREEN_Write(1);
}
UART_UartPutChar(accRegValue);
}
However I'm getting the same result, DATA_READY flashes red rapidly and at regular intervals, but Green(activity interrupt) never flashes.
Could you ellaborate on readword() function, I'm not understanding what I'm supposed to do there. Also my I2C communication is working perfectly so I don't know why I should put an I2C_Error() function in there, and also what the I2C_Error shoudl do isn't clear to me.
I've Updated my components now, and changed the code a bit (PFA). Instead of LED depending on INT_SOURCE's value, I'm making it change with the Interrupt subroutine.
I've connected the PSoC board to the PC with no information on voltage level. I have connected the 3.3V pin to the ADXL345's Vcc.
Regards,
Viraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Some of the Cypress kits (I am not aware which one you have got) can be switched from 5V operation to 3.3V. You need to run at 3.3V
Check with a logic analyzer the interrupt input to the PSoC
The error checking function as I implemented as an example unburdens you from all the queries of the "commStatus" variable. In practice you can put a "Blink red sign" or something similar to show that it is not working or even issue a CySoftwareReset() API.
Bob