I'm trying to activate authentication for my RN4020 Bluetooth module in a way I dont have to enter PIN or Passcode during this process because my RN4020 wont have any displays or keyboards where to display or enter PIN.

This is what datasheet(table 2-7, page 29) says about it


This command sets the supported features of current RN4020 module. The input parameter is a 32-bit bitmap that indicates features to be supported.

Auto Advertise 0x20000000

Enable Authentication 0x00400000

I/O Capabilities 0x000E0000. I/O capability of the module. Only useful if the Enable Authentication bit is set.

  • ‘b000 = Display Only

  • ‘b001 = Display Yes/No

  • ‘b010 = Keyboard Only

  • ‘b011 = No Input, no output

  • ‘b100 = Keyboard Display

This is already where the mystery starts because its not said in the datasheet where the (I suppose) binary values for these I/O capabilities are supposed to be in this hex32 number.

I read here about disabling pin when making authentication(pairing) process

First, disable authentication, so that RN4020 won't ask for a Pin code. For the parameter of command "SR", bit 0x00400000 should be cleared.

which is already weird because why would I disable authentication if I'm trying to do it and I/O capabilities are working only if the Enable Authentication bit is set. And next...

On the other hand, declare that RN4020 has no I/O capability, so the peer device won't ask Keyboard I/O authentication. For the parameter of command "SR", the 3 bits 0x000E0000 should be set to 0x00060000 to indicate RN4020 has no I/O capability.

What the number 6 is standing for? And again if authentication is disabled by disabling bits 0x00400000 then these 0x000E0000 I/O capabilities are not supposed to work at all. But mystery is that when I use SR,20060000 it actually works and I can bond devices without using PIN. Can anyone explain this?


The I/O capabilities bitmask value is 0x000E0000 and the binary values you list are the 3 MSBs in the "E".

I have used these modes: Display only - the RN4020 UART outputs a 6-digit passcode which must be entered in the connecting device. Keyboard only - the connecting device is sent a passcode which must be entered on an input device connected to the RN4020.

I also tried No input, no output and was unsuccessful in connecting. I haven't figured out how to store a fixed PIN that the connecting device must enter.

  • \$\begingroup\$ Ohh, tnx a lot man it makes sense - If I want to specify b011 = No Input, no output in place of E I have to use b0110 which is 6 in hex. I have already switched to Bluetooth Classic because of not being able to scan for direct advertisement post Android 6 but this will be very helpful to other people :) \$\endgroup\$ – etrusks Jul 26 '18 at 7:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.