Close
0%
0%

BTCON

Bluetooth based console connection for Microchip embedded controllers.

Similar projects worth following
Allows you to connect to a microcontroller's RS232 port using a plug-in Bluetooth connection. Handy for development work or to use as a service port.

I use Microchip 8-bit MCUs in many of my projects and have always found accommodating ICSP (In Circuit Serial Programming - Microchip's method of loading firmware once the MCU is installed) a hassle.  The standard .100" pitch header takes up a ton of room (or even the RJ11 Microchip recommends) but, if you don't install some sort of connector then your stuck clipping probes to the pins.  That gets old quick and may not be practical with some SMD packages.

Then there's the need to debug and perhaps manually step thru parts of the operation to figure out what's going on.  Sure, the debugger is sometimes necessary but most often the more difficult problems are how the MCU is interacting with the circuit.  If only there was a console to issue simple commands and display data & peripheral status.

This is what BTCON enables and is silly-simple and solves two problems.  It uses Microchip's RN4677 Bluetooth module to provide an RS232 connection that can be accessed from any terminal emulator on Linux/MAC/Windows that can communicate via Bluetooth SPP.  It connects to the MCU in your project using a USB Micro-A/B jack which is in turn wired to Vdd & GND and the MCU's ICSPDAT, CLK, and Vpp pins.  So you not only get a console that plugs into your project, you also get a compact method for connecting your PICKIT without taking up much room.  The connector is pinned to the USB standard for power & ground so chances are that no damage would be inflicted if some other USB device were plugged in.

This approach only requires the dedication of three pins on the MCU and the associated space on the PCB to accommodate the traces & USB jack.  I've found it indispensable, particularly on complex projects.  I am even incorporating it as a 'service port' on some of my finished projects.

The pictures show BTCON assembled in it's case & open as well as a separate cable that adapts the PICKIT 6-pin .100" pitch header to USB.  Also included is a picture showing the USB connector mounted near the MCU in a working design.

Only a handful of parts are necessary to build the dongle.  BTCON expects to get +5V from the USB connection and includes an onboard 3.3V LDO.  The RN4677 does include a 3.3V LDO but only accepts a maximum input voltage of 4.3V.  You'll also notice a voltage divider (R1, R2) on the BT module's Rx pin to keep voltages <3.3V; this assumes the MCU is using 5V.

The RN4677 can be used as-is from the factory but there are a few settings which should be changed to make connection management easier (service & broadcast names) - those are covered in the instructions.  I leave the baud rate at the factory default of 115.2Kbps which means this is the baud rate that must be used with MCUs as well.

You may have difficultly obtaining the RN4677 since Microchip recently marked it for end of life and I think they're recommending the RN4678 for new designs.  I haven't looked that closely at it for pin compatibility but I believe the major change is support for BLE 4.2.

End of life for the RN4677 may not be a bad thing since it has some quirks and the documentation needs improvement.

  1. The documentation for the RN4677 says HW flow control can be enabled / disabled; it cannot and is always on.  That's why BTCON has the RTS & CTS lines connected.
  2. It will not allow a connection if it doesn't see valid electrical states on the RX & TX pins when it boots.  This shouldn't be a problem for BTCON since it derives its power from the unit it's plugged in to.  But, be aware that if you power-up an RN4677 and the RX/TX lines are open you won't see BT advertisements or be able to connect to it (even if you have its address).  I've found this to be true even when subsequently connecting the pins.
  3. The RN4677 will lock up if left running for >2 days without a connection.  This happens even if there are periodic...
Read more »

btcon.zip

Eagle schematic & PCB for BTCON.

Zip Archive - 37.35 kB - 05/03/2018 at 19:30

Download

usart.zip

USART console service routines for Microchip 8-bit midrange MCUs.

Zip Archive - 7.92 kB - 05/03/2018 at 19:30

Download

  • 1 × RN4677-V/RM100 RF TXRX MOD BLUETOOTH CHIP ANT
  • 2 × 10K RES SMD 10K OHM 1% 1/8W 0805
  • 1 × ZX62-AB-5PA(31) Hirose Electric micro AB USB 2.0 Receptacle Connector 5 Position Surface Mount, Right Angle
  • 1 × ZX40-B-5S-UNIT(31) Hirose Electric micro B USB 2.0 Plug Connector 5 Position Free Hanging (In-Line)
  • 1 × ZX40-B-SLDA Hirose Electric Connector Shielding Plate, Top For USB - microUSB B Plug

View all 12 components

  • 1
    Assemble board.

    The RN4677 should be installed first.  The package I used for it contains enough exposed pad area so it can be hand soldered with a 1/16" chisel tip.

  • 2
    Assemble plug.

    The USB A/B connector consists of the plug and top & bottom shell halves.  You'll need a length of 4 or 5 conductor signal wire, no larger than 28AWG.

    The Eagle schematic contains the pin assignment.

    Don't connect the cable to the board yet unless you don't want to customize the RN4677 settings in the next step.

  • 3
    Customize RN4677 settings.

    You should have the Microchip RN4677 Bluetooth® 4.0 Dual Mode Module User’s Guide handy for this step.  Familiarize yourself with the command syntax and how to enter/exit command mode.

    First connect the Rx & Tx lines to an RS232 port on a computer.  IMPORTANT:  make sure the signal levels from the computer are compatible with 5V TTL.  Standard RS232 from a DB9/25 on a PC are much higher and will destroy the unit.

    Load a terminal emulator, connect to the RS232 port and make sure flow control is disabled.  Set the baud rate to 115.2Kbps, 8 data bits, 1 stop, no parity.

    Decide on a name for your dongle like "BTCON".  You'll use it in the following commands (reference guide for exact syntax):

    • Device name - SN,
    • Service name - SS,
    • Serialized friendly name - S-,

    It's also a good idea to clear the extended status string.  This is a string sent to the MCU when a Bluetooth connection is established.  This ensures it doesn't get interpreted as a command:  SO, .  Note that there's a space after the comma.  The space is what clears the default string.

    These settings are stored in NVM but won't display until the unit is rebooted or power cycled.

View all 5 instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates