FIXED! Yes, it was UART settings. BLE-CC41-A needs HAL_UART_ISR to be set to 2 (was 1).
To build firmware, use
IAR Embedded Workbench for 8051 9.30 + BLE-stack v1.4.0.
IAR Embedded Workbench for 8051 is here:
https://www.iar.com/iar-embedded-workbench/#!?device=CC2541F128&architecture=8051BLE-stack 1.4.0 is here:
http://www.ti.com/tool/BLE-STACK-ARCHIVECopy cc254x-hidKbdM folder from
https://github.com/rampadc/cc2540-hidKbdM to C:\Texas Instruments\BLE-CC254x-1.4.0\Projects\ble\cc254x-hidKbdM
Open project cc254x-hidKbdM\CC2541DB\HIDKbdMouse.eww in IDE.
Edit project options as here:
(Haven't changed anything here except HAL_UART_ISR=2. It finally worked.)
To fix compilation errors (identifier "bStatus_t" is undefined), add #include "gatt.h" to the KBD_report.h, after #include "hal_types.h".
It doesn't pair with mobile devices for some reason. To fix it, set DEFAULT_IO_CAPABILITIES to GAPBOND_IO_CAP_NO_INPUT_NO_OUTPUT.
Then build it, convert intel hex to bin with
http://hex2bin.sourceforge.net and upload via Arduino Nano with CCLoader sketch, as described above.
I used command line "CCLoader.exe 4 HM-10_CC2541_Experimental.bin 0" for COM4.
Mind that a new firmware is really quiet, so it's rather tricky to check it out after uploading.
Use standard RX/TX pins (from the module, aka voltage dividing board) via USB-TTL adapter.
I used serial monitor from Arduino IDE. Connected at 57600 with CR & NL (README.md mentions 9600 but it's bull****, it's 57600 in the code).
It is in command mode by default. Try commands S,S and S,A, it's the only commands that output something (SLEEP and ACTIVE accordingly):
Then pair it to the computer with pin 000000:
Then enter command mode - type $$$+enter and then any string (I used 123+enter, it should go into an endless loop of typing, which is kind of fun, considering it works):
All other commands are described in README.md:
The device operates in 2 modes: command mode and translation mode.
- If 3 consequence @'s, ie. @@@ is sent, put device into command mode
- If 3 consequent $'s, ie. $$$ is sent, put device into translation mode
In command mode, the device parse commands sent by the host that are followed by
a CR or LF character. The list of commands implemented is listed below:
+ KU[value]: a key is released with an 8-bit value that corresponds to a HID keycode
+ KD[value]: a key is pressed with an 8-bit value that corresponds to a HID keycode
+ M[status][X][Y][Z]: sending mouse buttons and mouse coordinates
+ KUPDATE: send report to host
+ S,R: reset the device
+ S,DC: disconnect from host
+ SN,[value]: change scan response data's string and device name. [value] must be less
than 20 characters long. Restart device to see changes.
I probably should rewrite the code, make it respond to AT commands and maybe make a necessary and sufficient RN-42 clone with BT 4.0, it would be extremely useful for power saving. I think it could replace that RN-42 module on the Hasu HHKB Alt Controller and drastically improve battery life of this board (hi, Hasu!). But maybe later. Cheers.
Mandatory 1-key keyboard, now with Bluetooth 4.0:
Keyboard sketch is here:
http://pastebin.com/JyE02qjSFull album is here:
http://imgur.com/a/KWmz6Updated firmware is here:
http://pastebin.com/zRcQV6YwP.S. I would be really glad to see more people making their projects using this chip. It's way cheaper and easier than dealing with nrf51822 and (I'm pretty sure) could be programmed to handle a keyboard matrix with its 20 GPIO pins without an external MCU. Looking forward to more CC2541/8051-based projects.