Freertos ble peripheral server bond extend BLE profiles

Dear Community

I am using the “freertos_ble_peripheral_server_bond” example which includes a custom and a BAS service profile. I would like to extend this example with other profiles such as HID or custom services.
Custom services are not the problem since I can copy+paste the existing “app_customss” source and header files and rename and modify it.
I struggle more with adding the HID profile.
I compared the projects “freertos_ble_peripheral_server_bond” with the “peripheral_server_hid” and I see some differences in how the profiles are added.
The guide “RSL10 Sample Code User’s Guide” describes a way how to extend existing projects with either premade profiles or custom services. The description matches with the files of “peripheral_server_hid” but not with the “freerots_ble_peripheral_server_bond”. So how do I included the HID profile there? I enabled in the rte the profiles HID but no code is generated in “RTE → Device → RSL”. Doesn’t need to be code generated such as in “ble_hid.c” which can be used in the application layer?

Many thanks and best regards
Robert

2 Likes

@naer

So far RSL10 abstraction can only support a few of standard profiles which can check and then add related *.c file and *.h into RTE - Device - RSL10 folder automatically.
They are listed in here.

Unfortunately, HID profile is not there so far.
You need manually copy ble_hogpd.c and ble_hogpd.h from peripheral_server_hid project into
RTE - Device - RSL10 folder.

After that, using peripheral_server_hid for reference, you can add HID profile into Free_ble_peripheral_server_bond project.

Thank you for using our community forum!

Dear Martin

Thank you very much for your reply. So I explain what I did:
I copied the ble_hogpd.c and .h files from the “peripheral_server_hid” into the RTE → Device → RSL10 folder and followed the instruction in the pdf file Sample Code Users Guide in chapter “How to Add a New Standard Service/Profile”. There I inserted the CFG_PRF_HOGPD in the includes and the amount of error reduced.
I now recognized that the ble_hogpd file does not have the same structure as the ble_bass files from the freerots_ble_peripheral_server_bond example. The instruction in the Sample Code User Guide does not seem to fit for the freertos example. Are you sure it will work like that or how am I supposed to implement this? I see a discprepancy between your documentation Sample Code Users guide and your example freertos_ble_peripheral_server_bond.
For example in the ble_bass.h from RSL10 folder there is not list of message handler such as in ble_hogpd.h.
/* List of message handlers that are used by the HID over GATT profile for

  • device role application manager */
    #define HOGPD_MESSAGE_HANDLER_LIST
    DEFINE_MESSAGE_HANDLER(HOGPD_ENABLE_RSP, Hogpd_EnableRsp),
    DEFINE_MESSAGE_HANDLER(HOGPD_NTF_CFG_IND, Hogpd_NtfCfgInd),
    DEFINE_MESSAGE_HANDLER(HOGPD_PROTO_MODE_REQ_IND, Hogpd_ProtoModeReqInd),
    DEFINE_MESSAGE_HANDLER(HOGPD_CTNL_PT_IND, Hogpd_CtnlPtInd),
    DEFINE_MESSAGE_HANDLER(HOGPD_REPORT_UPD_RSP, Hogpd_ReportUpdRsp),
    DEFINE_MESSAGE_HANDLER(HOGPD_REPORT_REQ_IND, Hogpd_ReportReqInd)

At the moment I am still facing some errors while adding HID profile to the freertos_… project.

Best regards and nice weekend
Robert

@naer

I have attached a modified freertos_ble_peripheral_server_bond project and I have added HID profile.
The reference project (freertos_ble_peripheral_server_bond) is based on RSL10.3.6.465.

Since I have selected DIO5 (BUTTON_DIO) for UART_TX , so this project selects DIO0 (touch to ground) to perform keyboard click.

image

To verify this HID function (after pairing success), you can use GPIO0 pin and touch to GND pin.

On your computer go to Bluetooth & other devices,

Once connected RSL10 board , DIO6 LED is steady on.
image

Touch DIO0 pin to the GND pin on the RSL10 board and you will see letters on notepad , which are defined in on_semi_banner_str.

static struct on_semi_banner_str on_semi_banner[]

image

freertos_ble_peripheral_server_bond_H.7z (598.9 KB)

Thank you for using our community forum!

1 Like

Dear Martin

Thank you for your reply. I have been analyzing this code and the integrated HID part is quite helpful.
I have still some questions and issues with the project / system.
First of all, you inserted “ble_hogpd.c” in the source folder. I am wondering, if the code there is on the application layer or still belongs to the ble stack like the ble_diss.c file in folder RTE->Device->RSL.
So what I would do next, is to seperate the functions and definitions in the ble_hogpd files into ble_hogpd and app_hogpd file, so the structure is the same as with the remaining profiles. Is this method reasonable?
grafik

Next I downloaded the project on the RSL10-sense-gevk development board. As central device I am using the nRF Connect App. The data from the custom service can be received, also the battery level is transmitted correctly. Unfortunately, I receive 30s to 2 minutes after connecting the GATT Error 0x8 on the nRF Connect app. The time seems to be random. Similar issues in forums tend towards a hardware issue. I tried another RSL sense GVK eval board and it behaves the same way. I have no idea what causes this error. Do you have an idea?
What I am gonna do is to install a sniffer and take a look at the transfer.

Best regards
Robert

Hi @naer ,

  1. You can build your own app_hogpd.c and app_hogpd.h for your own application.
    You can use ble_hogpd.c and ble_hogpd.h as abstraction layer files. (like ble_diss.c etc.)

  2. The attached project is for our RSL10-002GEVB. I has not been tested on RSL10-sense-gevk development board.

  3. Could you please try this on RSL10-002GEVB and see if you can get the same issue?

Thank you very much for the response, that helped.
I still think, that in the ble_hogpd.c file are some functions they should be in the app_hogpd.c file. Am I right?
I will look if we have the RSL10-002GEVB inhouse.
Cheers
Robert

Hi @naer ,
Yes. You are right. The project is just a reference to show HID profile.
The ble_hogpd.c is not optimized.

Hi @larry.zhu and @martin.bela

I tried to run the project on the RSL10 Development (SiP). There occured the same error as in the Sense GEVK board. The error is 0x08 and occurs on the central device in the nRF Connect app when the central does not receive a response from the peripheral after 5s. The Watchdog is probably set to 10s (I have not checked), therefore after when the connection is lost, the sensor node does reset after 5s and advertises itself. I checked these behaviour on a sniffer I set up.
Furthermore, Bonding does not work as well, the connection is lost after starting bonding.
I am a bit confused, since according to @martin.bela the project was rested on the RSL10 Evalboard.

Honestly, I have not checked what causes the error exactly. When writing these lines, but I am going to do this.

Thank you and best regards
Robert

Hi @naer ,
I have RSL10 SIP EVB. Could you please tell me the test procedures? I would like to check on my side.

  1. You are using the attached the project, right?
  2. For example: could you see this issue in freertos_ble_peripheral_bond sample project?

Thanks,

Dear @larry.zhu
Thanks for the fast reply.

  1. Yes, I do.
  2. I was using freertos_ble_peripheral_server_bond. Did you miss the server or are these two different projects? Anyway, the ble_peripheral_server_bond does work without the error. The ble_peripheral_server_bond_H you sent in this thread does not. But with both projects it is possible to bond.
    I hope this helps.

Best regards
Robert

Hi @naer ,
Thanks for your update.

  1. My ble_peripheral_server_bond_H is based on ble_peripheral_server_bond. It just added two profiles.
    you can compare both projects.
  2. Could you please share your test procedures which I can reproduce this on my side? Thanks.

Hi @larry.zhu

  1. I am using freertos_ble_peripheral_server_bond and the freertos_ble_peripheral_server_bond_H with the additional profile.
  2. I have a Samsung Galaxy S9 where I installed the Nordic Semiconductor “nRF Connect” app to receive data. When I flash/debug the RSL10-Sense-Gevk with the project “freertos_ble_peripheral_server_bond”. The advertising of the peripheral works fine and the connection can be established, when connecting the smartphone with the RSL10-Sense-Gevk. in the beginning data are sent from the Humidity and Temperature profile as well as from the Battery Service. After a while, the connection is lost and the error on the “nRF Connect” App 0x8 Gatt Conn Timeout appears. The error does not appear on the “freertos_ble_peripheral_server_bond” project.

I hope this helps
Robert

Hi @naer ,
I need double check with you.
The freertos_ble_peripheral_server_bond_H is for our RSL10 QFN EVB.
I could not see any humidity and Temperature profiles in there.
I have tested the project with my RSL10 QFN EVB with S20 + nRF connect app.
I could not see any disconnect issue and HID is OK.

Hi @larry.zhu
Thanks for the reply.
In the freertos_ble_peripheral_server_bond_H there is a app_custom.c and .h file where the custom profile is defined. In my case it is shown as Humidity and Temperature in the app, but I have no idea why. Anyway, the UUID shown in the app is the one defined as “CS_SVC_UUID” in app_customss.h. Also the characteristics correspond to the defines CS_CHAR_XX_UUID. At the characteristics CS_CHAR_TX_UUID, there will be dummy data sent (20 Bytes) every 6s which start at 0 and increment after every packet sent. I will try to test again the project with another EVboards.
What I recognized sometimes during debugging, that the Sense Gevk Board occurs a 0xdeadbeee error.

Thank you for your engangement!
Robert

Hi @naer ,
I have tested this for two hours and there is no error information in nRF connect app.

  1. RSL10-002GEVB (RSL10 QFN EVB)
  2. Samsung S20 +nRF connect mobile app v4.25.3
  3. freertos_peripheral_server_bond_bond_H project.
  4. load the hex into board and you will see device name “HID_Testing”
  5. connect this and bond it.
  6. use DIO0 touch GND pin. you will see “RSL10 ON…” on the phone note
  7. In the meantime, you can see battery information and custom notification in nRF connect app log window.
  8. I could not see disconnection event and no error information in app log for 2 hours.
  9. Stop test.

Hi @larry.zhu

Thank you for the reply. I have been testing it on the RSL10 SIP EVB and it worked for approx. 1.5h, I then stopped the tests.
But it disconnects at the RSL10 Sense Gevk after a while. Sometimes after a couple of seconds, sometimes after dozens of minutes. What I also did, is using the RTT viewer. Therefore, I needed to change the memory section values.
This are the values I changed:

MEMORY
{
ROM (r) : ORIGIN = 0x00000000, LENGTH = 4K
FLASH (xrw) : ORIGIN = 0x00100000, LENGTH = 380K
PRAM (xrw) : ORIGIN = 0x00200000, LENGTH = 32K

DRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K
DRAM_DSP (xrw) : ORIGIN = 0x20008000, LENGTH = 40K
DRAM_BB (xrw) : ORIGIN = 0x20012000, LENGTH = 16K
}
I wanted to use the RTT viewer and debugging to print out information to detect the error. Unfortunately, the debugger disconnects as well and therefore no information are printed. The error 0x08 on the nrfConnect also occurs without the debugger.

Thank you.
Robert

HI @naer ,
You can see the issue is caused by board difference. I don’t have this sensor board on hand.
and freeRTOS_peripheral_sever_bond has no issue on sensor board.
so I think this might be DIO0 which is used in freeRTOS_peripheral_sever_bond_H project. This DIO0 is used for keyboard click.
Actually I think you can compare this two projects and see which code could cause this 0x08 error.

Dear @larry.zhu

Ok, I got it.
I changed in the section.ld in the memory linker description the ranges for the DRAM to following values to enable the RTT viewer:
MEMORY
{
ROM (r) : ORIGIN = 0x00000000, LENGTH = 4K
FLASH (xrw) : ORIGIN = 0x00100000, LENGTH = 380K
PRAM (xrw) : ORIGIN = 0x00200000, LENGTH = 32K

DRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K // Default would have been 24K
DRAM_DSP (xrw) : ORIGIN = 0x20008000, LENGTH = 40K // Default would have been 0x20006000 and 48K
DRAM_BB (xrw) : ORIGIN = 0x20012000, LENGTH = 16K
}
With default values and without the RTT viewer it works perfectly.
I still not quite understand why it influences the performance, since the DSP is not used in this application but I am glad, that I have a running project now.
I appreciate your help.
Robert

Hi @naer ,
Thanks for your update.
DSP memory can be used as normal RAM.
Our designed team has found this issue in all freertos sample projects as well. We will update sections.ld file in the next SDK release.

1 Like