PSoC™ 4 Forum Discussions
Hello everyone,
I wonder if anyone could have a quick look at my project to suggest what I am doing wrong. This is a project that I had downloaded from Sam's blog, and I am following pretty much what he recommends. The code runs but throws an error that " MPU6050 connection failed" followed by printing 0 all over.
I would like to mention that: 1. I have used this code previously, and it had worked. 2. I testecMPU6050 unit Arduino and it worked fine, which means sensor board is OK.
Some of the community members had previously helped me getting started with this project. I am hoping they would me understand the issue. I am attaching the project below. I would appreciate if someone could run on her computer.
Show LessHello
I have been doing electronics since 1968 but BLE only for 1 month.
I have a very simple project with two modules (each equipped with a CYBL10162-56LQXI) that I have to make in 15 days!
A push button on one module, a relays on the other module.
If the button is ON the relay must be ON
If the button is OFF the relay must be OFF
I use PSOC4 V4.2
Thank you
Yves
Hi,
I'm researching what is the maximun throughput via notification that can be achieved. Is there any limitation regarding the number of packtes in one connection interval?
I want to send a max of 32 bytes a packet, how do i know how many packets it will send?
Thank you
Show LessHi,
I am trying to build a simple SPI slave communication protocol for an existing master. The master device is an Atmega microcontroller, with an SPI clock approximately 40Kbps.
There are two types of messages: first one is master write messages, and second one is master read messages. And I want to implement all protocol logic in interrupt handler...
The problem is; I cant simply use buffered mode, since master write packets should echo the incoming packet (with one or two bytes exception) immediately.
SCB is configured in SPI slave mode, with 0 software buffer size (RX and TX buffer sizes are 8). Interrupt is configured as Internal, and the only interrupt source selected is "RX FIFO Not Empty".
Code is written with following naming notations...
Every thing starting with cy are cypress conponents, and everything starting with comm are related with my communication routines.
the following code is my custom SPI ISR function.
//WRITE MESSAGE FORMAT:
// <WriteSlaveCommand><TotalSize><PayloadSize><...PAYLOAD...><MasterMagic><CRC>
// Response should be an echo (only change MasterMagic with SlaveMagic, and update CRC accordingly)
//READ MESSAGE FORMAT:
// <WriteSlaveCommand><TotalSize><PayloadSize><...0xFF's...><MasterMagic><CRC>
//Response should be populated accordingly
void _commParsePacket(void)
{
//store received byte
_commRxByte = cySPI_RX_FIFO_RD_REG;
while(0u != cySPI_GET_RX_FIFO_ENTRIES);
cySPI_ClearRxInterruptSource(cySPI_INTR_RX_NOT_EMPTY);
//if software buffer enabled
//cySPI_rxBufferHead = 0;
//cySPI_rxBufferTail = 0;
switch(_parseIndex)
{
//wait for Write or Read command
case 0:
commRxCrcReset();
commPacket.command = _commRxByte;
//Clear/Invalidate TX buffer
cySPI_TX_FIFO_CTRL_REG |= 0x00010000;
cySPI_TX_FIFO_CTRL_REG &= 0xFFFEFFFF;
if ((commPacket.command == WriteSlaveCommand) || (commPacket.command == ReadSlaveCommand))
{
commStartedCount++;
commTxCrcReset();
_commTxByte = commPacket.command;
if (commPacket.command == WriteSlaveCommand)
{
commPacket.payload = (unsigned char*)&commMosiPacket; //if command is a write command, fill this structure
}
else
{
commPacket.payload = (unsigned char*)&commDummyPacket; //if command is a read command, fill a dummy/temporary structure
//note: already populates MisoPacket is going to be transferred
}
_parseIndex++;
}
commRxCrcUpdate(_commRxByte);
break;
// wait for total size
case 1:
commPacket.totalSize = _commRxByte;
_commTxByte = commPacket.totalSize;
commRxCrcUpdate(commPacket.totalSize);
_parseIndex++;
break;
//wait for payload size
case 2:
commPacket.payloadSize = _commRxByte;
commRxCrcUpdate(commPacket.payloadSize);
//check for payload sizes... return to parseIndex=0 to avoid a possible data overflow
if( ((commPacket.command == ReadSlaveCommand) && (commPacket.payloadSize == 5)) ||
((commPacket.command == WriteSlaveCommand) && (commPacket.payloadSize == 17)) )
{
_commTxByte = commPacket.payloadSize;
_parsePacketIndex = 0;
_parseIndex++;
}
else
{
_parseIndex = 0;
}
break;
//fill payloads
case 3:
if (_parsePacketIndex < commPacket.payloadSize)
{
commPacket.payload[_parsePacketIndex] = _commRxByte;
if (commPacket.command == ReadSlaveCommand)
{
_commTxByte = ((unsigned char*)(&commMisoPacket))[_parsePacketIndex];
}
else
{
_commTxByte = ((unsigned char*)(&commMosiPacket))[_parsePacketIndex];
}
commRxCrcUpdate(_commRxByte);
_parsePacketIndex++;
}
if (_parsePacketIndex == commPacket.payloadSize)
{
_parseIndex++;
}
break;
//replace magic numbers
case 4:
commPacket.magicNumber = _commRxByte;
_commTxByte = SlaveMagic;
commRxCrcUpdate(commPacket.magicNumber);
_parseIndex++;
break;
//wait and check for CRC's
case 5:
commPacket.crc = _commRxByte;
_commTxByte = commTxCrcGet();
_parseIndex++;
if (commPacket.crc == commRxCrcGet())
{
if (commPacket.command == WriteSlaveCommand)
_commSuccess = 0x00;
}
break;
//wait for my CRC to be send...
default:
_parseIndex = 0;
//_commResetTXBuff();
//return;
break;
}
//transmit
cySPI_TX_FIFO_WR_REG = _commTxByte;
commTxCrcUpdate(_commTxByte);
//if software buffer enabled
//cySPI_txBufferHead = 1;
//cySPI_txBufferTail = 0;
return;
}
I am using Psoc Creator 4.1, and my device is CY8C4124...
Also note that "Slave Select" is always selected.
Problem is;
1 - It seems nearly 1/2 of the time, they just communicate ok.
2 - If I read failed packets, I see data is late 1 or 2 bytes...
Thanks...
Show LessHi,
i am working currently with cyble-222014-01 module.i am using the internal RTC. I wanted to put the system in sleep mode .but the system is
not in sleep mode because for rtc updation i am using the system timer API's to update the RTC
CySysTickStart();
/*config Systick Timer to Generate interrupt every 100ms*/
CySysTickSetReload(SYSTICK_RELOAD);
/*Find unused Callback Slot*/
for (loop_count = 0u; loop_count <CY_SYS_SYST_NUM_OF_CALLBACKS; ++loop_count)
{
if (CySysTickGetCallback(loop_count) == NULL)
{ /*Set Callback */
CySysTickSetCallback(loop_count,SysTickIsrHandler);
break;
}
}
so,due to this my ble is not in sleep mode ,it is always in on state only if i disable the system tick then the sleep working but the RTC is not updating
i want Auto update of RTC and sleep mode also enable.
Please give suggestions to resolve the issue.
Thanks in adavance
Show LessHi I have a problem with bonding issue. I have created a BLE device with following configuration
Now the device I am implementing doesn't have input and output to perform authentication. As a result when I go for secure connection, I chose pairing as Unauthenticated Pairing with Encryption
Now I am trying to pair it with LightBlue Application running on my Mobile phone. So I see that the connection to my BLE device happens successfully. However there is no Bonding that happens although I have enabled bonding in the configuration. Also I am not even getting CYBLE_EVT_GAP_ENCRYPT_CHANGE event. I am not sure if there is something I am missing in the configuration. For your information I am attaching my stack handler code as well.
Please let me know what I am doing in correct out here. I had a look at the PSoC 100 projects in 100 days as well PSoC-4-BLE/100_Projects_in_100_Days at master · cypresssemiconductorco/PSoC-4-BLE · GitHub but couldn't find too much information regarding my problem. I am not sure what am I doing incorrect.
Best Regards,
Shrey
I'm using an EZ BLE module CYBLE-214009-EVAL with a Pioneer board and trying to use the example program BLE_4.2_DataLength_Security_Privacy. It complains that I'm trying to use a data length greater than 27 bytes which my device can't handle. I take this to mean that the EZ-BLE module has BLE 4.1 or earlier and so can't deal with BLE 4.2 settings.
Can this device be upgraded to BLE 4.2?
Would you be kind enough to tell me how to do it?
Thanks,
Dennis
Show LessHi, I need support about additional include directories and relative path issue in Psoc 4.0. In my project, although I added my header file directory to related place(build setting-compiler-additional inc. dir.), I am taking the error that "No such a file or directory". I take screen shot to show the problem clearly. it is added picture. I find that to include file as: "#include ".../.../.../includingfilename/sourcefilename.h"". But, because of the characteristics of our project, i cannot use that way. I should include the file by the first way. But I could not. Could you give advise about the problem. What it can be reason of it.
Show Less