Part Number:LAUNCHXL-CC2640R2
Tool/software: TI-RTOS
Hi E2E
I have a very strange issue, and I can't figure out why my custom server application acts this strange way. It's a bit hard to explain, but I'll try my best.
It seems that my application needs 30 secs or so, to be fully setup after connection is established.
I've developed a custom application, based on the ble5_simple_peripheral example. I've added a few services, with a few characteristics each, and I've confirmed that this part works as intentioned. I need a timer based interrupt with a semaphore block, and when I compile my application with the timer, tasks, mailboxes and a few other drivers implemented, the application works fine => I can connect to it right after power on, and read all of it's services right after connection is established.
But my problem then occurs, when I try to implement the semaphore module ONLY by including the library, and the following code:
/************************************************************************************************* Semaphore START **************************************************************************************************/ Semaphore_Params semaphoreParams; Semaphore_Handle LEDsem_handle; Semaphore_Struct LEDsem_struct; /************************************************************************************************* Semaphore END **************************************************************************************************/ void main() { /* ... */ /* Create semaphore for LED control */ Semaphore_Params_init(&semaphoreParams); semaphoreParams.mode = Semaphore_Mode_BINARY; Semaphore_construct(&LEDsem_struct, 0, &semaphoreParams); LEDsem_handle = Semaphore_handle(&LEDsem_struct); /* ... */ }
After these few lines are inserted to the project, I can't discover any of the services, right after the connection is established between the server (my application) and client (BTool with ble5_project_zero). I have to wait for around 30 seconds before the discovery can be successful. If the discovery have failed, I can see the following Log events/opcodes:
event: "TX: GATT_DiscAllPrimaryServices"
event: "RX: GAP_HCI_ExtentionCommandStatus"
event: "RX: ATT_ReadByGrpTypeRsp"
event: "RX: ATT_ReadByGrpTypeRsp"
opcode: "TX: GATT_DiscAllCharDescs"
event: "RX: GAP_HCI_ExtentionCommandStatus"
After this, I can se the following on BTool, like some of the discovery is succesful:
If this unsuccessful discovery has occurred, I have to terminate the connection, and connect again.
If I connect, wait for 30 seconds, and do the service discovery, there are no problems.
Another weird thing is, that if I switch the GPTimerxx26XX.h module, with a knl.clock module, and implement the semaphore driver, there seem to be no problems either. But if I then implement another task than I already have, the same problem occurs.
To me it seems like a memory problem or another kind of data corruption, but I don't know how to check that.
According to the .map file for the application, I have 10 k left on the flash, from a 127k total. This is when my application has problems. When there's no problems, I have 11 k left. I don't know if this has anything to do with my problem.
I hope it makes sense, and that some of you guys are able to figure out what kind of a problem this is, and how to solve it.
Kind regards, Peter