I have gotten a PSoC 4 BLE chip and soldered it onto my own board. It seems to be correctly soldered on because I have run a simple test program that turns on the LED and it works fine. The issue arises when I program a Bluetooth Program on the chip. I have programmed the chip with a simple Find Me program so that I can just test the antenna and other functions on my board. This program does not work on my board. I have debugged through the code so that I can find out where the issue is.
In main.c, I step over until the line apiResult = CyBle_Start(StackEventHandler); Then I step into this line. This opens up the BLE.c file. I can step through this program until the line
apiResult = CyBle_StackInit(&CyBle_EventHandler, cyBle_stackMemoryRam, CYBLE_GATT_MTU); This line hangs up the program and it will never get passed this line.
The main question I am having is why this could be happening. It seems obvious that there is an issue with initializing the Stack. Could this issue be due to the hardware on the board such as bad coupling caps? I have laid the board out the best I could be exactly like the BLE module that is included in the Development kit. As far as I can tell, everything is pretty much the same.
Could there be an issue with the chip itself that would allow it to run a simple LED program but not be able to run a BLE program?
Thanks for all replies.
Can you please check that the settings for heap = 0x80 and stack are 0x0800
I found that in the file cyfitter.h there is a line of code that says
#define CYDEV_HEAP_SIZE 0x400
and another that says
#define CYDEV_STACK_SIZE 0x0800
Are these these lines you are referring to? If so, should the heap size be 0x80 instead? Should I change that line of code?
No, wrong place. Stack and heap sizes are modified using the .cydwr file under the systems tab. I'm not very optimistic that a change wil help, but give it a try.
This mostly looks like a 24MHz crystal problem. Can you check if your 24MHz crystal and its load caps are properly mounted on your board?
Default Stack and Heap Sizes
The default stack and heap sizes for new projects have been adjusted to more closely match real-world
requirements. When new projects are created, the stack size is set to be a fraction of the total SRAM in
the target device. The heap is set to a small value - 128 bytes - for all devices. You can, of course, modify
these settings in the Design-Wide Resources System Editor. For example, if you are not using any heap
based memory allocation the heap can safely be set to 0 bytes.
Note that some example projects and application notes were originally created on older versions of PSoC
Creator and use the larger default sizes. These projects will continue to build and run perfectly because
they have sufficient memory allocated. However, if you attempt to reproduce the example yourself in your
own project you may need to adjust the stack and heap. However, the example documentation will not tell
you to do that because the original project did not require the settings to be changed.
My board has multiple BLE components soldered on. One of the chips that I have soldered on is working entirely perfectly. It connects via BT and does everything I want it to. The second BLE chip on the board is not working and is the one I am testing.
Upon further ispection of the board, it seems that the two 24Mhz clocks are soldered on differently. This is may be the root of the problem.
My only follow up question is why my little LED test program could work on a BLE chip that has a wrongly soldered on 24Mhz clock? The test program simply turns off and on each color LED one at a time with a CyDelay(1000); in between. Obviously, this is a very simple program but I am wondering if the BLE chip could still function without a working 24Mhz clock. Could it be using the 32kHz clock instead?
Anyway, thanks very much for helping me find this issue. I am going to repair the clock on the board and retest.
I think your LED project works as it is using IMO (internal to device) and not external crystal.
If you change the HFCLK (go to your project.cydwr file -> clocks -> HFCLK -> Direct_Sel) to ECO in your LED project, then that should also fail (if crystal is not working on your board).
I changed the clock setting on the BLE chip that was only working with the LED program and after changing the settings, it stopped working completely which tells me that the clock is indeed the issue here.
Thanks for all the help, I will resolder the clock and that should solve the problem.
I stumbled with the same problem as samsiek and in fact after changing the clock system to ECO, my program does not work anymore.
I had unsoldered the 24Mhz xtal and with some wires I soldered only the two pads of the xtal (I didn't solder the GND pads) so I could be sure that the Xtal was soldered properly (Yes, this increases the parasitic capacitance, but it is a temporary setup just to see if the xtal starts oscillating). However, does not matter how I connect the xtal because the program continues to get stuck in the stack_init function.
My schematic is the same as the one supplied by cypress (for CY8CKIT-142 module) and in the board layout I took care and I placed the xtal very close to the SoC. Does anyone have a clue of what I am doing wrong?
The xtal I am using is this one -> http://www.mouser.com/ds/2/3/ABM8G-10572.pdf
My supply voltages (VDDA, VDDD) are regulated separately by two MIC5205 LDO and VDDR is obtained from VDDD with a ferrite bead. This results in a voltage of 3.27 V.
Thank you all!
I have found the problem some weeks ago. I found a short circuit between VDD and XTALI pins under the cypress package. After soldering again the chip, everything started working just fine.
Thank you all and I hope this can help someone in the future.