DA14531MOD Bluetooth keyboard for iOS and Android

Hello,

I'm developing a BLE HID keyboard with few buttons. I started with BLE SDK6 example "HID-Gamepad-digitizer", removed joysticks and digitizer functionality, changed the report descriptor to report as a keyboard. It works on Android. I have mapped 4 buttons to type letters a,b,c,d.

First question - it does not work on iOS (iphone 11). I can connect and pair, but that's it. When I try to type in the app (e.g. web browser) - it does nothing.

Second question - when I use it with android, I need to pair again after BLE device power cycle. What I need to do to make the device reconnect automatically after power cycle?

  • Hi There,

    Thank you for posting your question online.
    Could you please clarify which SDK version you are working with?

    First question - it does not work on iOS (iphone 11). I can connect and pair, but that's it. When I try to type in the app (e.g. web browser) - it does nothing.

    Have you tried to attach the debugger and see if the source code is stuck?
    Have you tried to add BKPT and if the Keyboard functions are executed?
    Also, a BLE Sniffer capture would be helpful, so we can see which packets are being transferred over the air.

    Second question - when I use it with android, I need to pair again after BLE device power cycle. What I need to do to make the device reconnect automatically after power cycle?

    1) The Connection is initiated by the Central device (SmartPhone) by sending the CONNECT_IND packet. 
    So, the application you have developed, should scan, find the DA14531 and initiate the connection.
    2) You stated that you need to pair again, that should only happen during the first connection.
    Could you please share the security configuration you have made for this project?

    Best Regards,
    OV_Renesas

  • Thank you for posting your question online.
    Could you please clarify which SDK version you are working with?

    Thank you for a prompt reply! I'm using SDK_6.0.18.1182.1

    I will try to check if the source code is stuck with the iOS and will post the sniffer capture later.

    2) You stated that you need to pair again, that should only happen during the first connection.
    Could you please share the security configuration you have made for this project?

    I have not set up the security when I had this issue - basically left the configuration which is in HID-Gamepad-digitizer example. Could this be the reason?

    Then I added security code from SDK_6.0.18.1182.1 security example. I configured it as "Just Works" (#define USER_CFG_FEAT_SEC_REQ GAP_SEC1_NOAUTH_PAIR_ENC)

    The program works when loading from RAM and it pairs once, shows the passkey on phone and when restarting BLE on phone it just reconnects.
    After trying to write the program to the flash it bricks the module and I can not access it via SWD, I will try to use UART to delete onboard flash.
    Was something wrong with MCU using flash to run the code and to store the info of the phone (for reconnection)? How can I avoid this?
    What is the minimum security requirements to reconnect automatically after power cycle?

  • HI There,

    Thank you for the reply and apologies for the delay.

    The program works when loading from RAM and it pairs once, shows the passkey on phone and when restarting BLE on phone it just reconnects.
    After trying to write the program to the flash it bricks the module and I can not access it via SWD, I will try to use UART to delete onboard flash.

    Have you modified the SWD pins?

    During the pairing procedure, the necessary security information (BD address, LTK, IRK, etc) will be stored in the Bonding Table in the SPI Flash or in the I2C EEPROM. 

    For the DA14531MOD, the Bonding Table is stored at the end of the SPI Flash. 
    You should use 1-Wire UART to access the SPI Flash and delete the firmware.

    Was something wrong with MCU using flash to run the code and to store the info of the phone (for reconnection)? How can I avoid this?

    I will need to understand your security configurations and if you have set the Security/Bonding callback functions as shown in the ble_app_security example.

    What is the minimum security requirements to reconnect automatically after power cycle?

    If you have performed the pairing procedure, the next time the central attempts the reconnection, the DA14531 should connect automatically without going through the pairing procedure again.

    Best Regards,
    OV_Renesas

  • Hello, thank you for the reply!

    Yes, I found flash modified (using smart snippets tool) by DA14531 starting 0x0001E000 after booting from RAM and pairing a smartphone.

    I modified <SPI_FLASH_DEV_SIZE> in user_periph_setup.h to 128*1024 instead 256*1024 (set by default in SDK 6.0.18.1182 security example), since DA14531MOD uses 1Mb flash.

    I also commented out <FPGA_HELPER(FPGA_GPIO_MAP_2, SWD_DATA_AT_P0_5);> in user_periph_setup.c which probably was messing my SWD config. I guess this was something to do with pro dev-kit, which I don't use. 

    Now everything works as expected - it bonds to android and ios and reconnects after power cycle.

    I will try to use single wire UART later to access SPI-flash. But after flashing SPI-flash I can not access the device via SWD.

  • I managed to erase SPI-flash in DA14531MOD with single-wire UART using SmartSnipperts Toolbox. It was tricky because when using onboard flash, you have to disable reset functionality of the P0_0 pin in the code and it is required to reset device to "boot" from single wire UART. But I powered the device with P0_0 raised (in RST position) so it was not able to boot from SPI flash and disable itself.