This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NRF51822 and atmega32u4

Hello,

I am planning to use an atmega32u4 as a micro controller for a keyboard, and I'd like to use a NRF51822 as the bluetooth sender.

As i've read, NRF51822 is BLE HID capable but my doubt is how would I feed the info from the atmega32u4? Would I just feed it via UART and then let the NRF51822 send it via BLE?

  • That's one way of doing it - any kind of simple serial connection between the MCUs will work. You just write some simple code on the nRF chip to do the BLE comms and talk via serial.

    However the nRF51822 (and Nordic's other chips) are pretty capable MCUs, what do you need a second chip for, can you not do the rest of the processing on the nRF?

  • Well, I'd need USB support too (it should support USB and BLE) and also the firmware for the matrix read and keyboard stuff is already done (QMK).

    Basically what I want to do is take the QMK output, redirect to the UART or similar of the NRF then send it via BLE to the device.

    So I should just poll for new data ( a keycode ) on the RX port and then send it using BLE?

    Would it be possible to use BLE HID when receiving data from the UART?

    Any tutorial on doing this? It's the first time using NRF itself, even though I have experience with MCU's

  • I'd start with the HID Keyboard example, that has everything you need for the BTLE side of things. That example uses buttons on the dev kit to trigger keyboard events but that's the bit you're going to change.

    Similarly there's a UART example which just shows how to use the UART driver (you can use UART, or SPi or TWI or any other kind of serial interface you want). You just then need to integrate the UART driver into the BLE HID code so incoming data triggers the BLE HID. You should be able to use an interrupt driven UART driver so you don't have to poll for anything, just sleep and wait for data.

Related