stephendpmurphy / MicrochipBM7x_FlashUpdate

Microchip BM70 and BM71 Flash update using only a host uC UART connection

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Microchip BM70 and BM71 Config/FlashUpdate

I owe a lot of credit to BKISHDROID on YouTube for doing some great work and documenting most of which you will find in the ReadMe. There were some moments in his videos were he mispoken which can cause confusion, as well as some bugs in the code he provided. I will try to clear up any confusion in this ReadMe, as well as place the corrected code and diagrams in this Repo.

Intro

What does this repo entail?

This repository will document all of the intricacies that you will need to know before starting any development work with your BM7x module. This repo also documents the process of updating the BM7x configuration using only your host uC UART. The configuraiton sent is generated using the tools provided by microchip, but you will not need an external serial communication to apply it since we can do it through our firmware.

Why won't my BM7x module respond to me?

I too ran into this problem. After placing a new BM70/71 onto my board and attempting to send it commands using the OPT codes specified, I was getting no reponse. I checked through the HW a 100x times over before finding the above mentioned YouTube video. It all made a lot of sense once I did. By default the BM chips are sent to a user in the "Auto Operation" mode. While in Auto Operation, the chip will begin advertising once put into the app mode, and acts as a data pipeline only. This means that all OPT code commands (The ones that start with 0xAA), will be IGNORED! So any UART data written to the device, will be sent out over bluetooth to any other BM module it is connected to. Also notice that I said any other BM module.. By default in Auto Operation, the BM modules, will only talk to one another. So if you want to use the module for connecting to a mobile device or PC, you will need to update the settings in Flash either using the Tools provided by microchip, and place the BM module into a "Manual Pattern Mode".. OR you can send the same configuration generated by the PC tool using your Host uC source code, which is why this Repo exists and is covered in the source code provided. This makes it great for developing some way of not only delivering new Firmware to a target device, but also allows the configuration of your BM7x module to be updated in the field as well.

Hardware

Minimum Hardware connections required for succesfully communicating

http://microchipdeveloper.com/ble:bm71-mcu-interface
At the bare minimum a UART connection utilizing an RX and TX pin is required. You do not need flow control by default (CTS, RTS). You will also need to connect the NRST pin of the BM7x to an output GPIO of your host uC.. This can be substitued with a pushbutton or switch, but I highly recommend you just use a GPIO pin.

Lastly, depending on what operation mode and settings you choose, you may need to connect up a wakeup pin of the BM7x to a GPIO output on your host uC. The BM70 has a WAKEUP_PIN that will be used, but since the BM71 has a smaller footprint, this functionality is utilized through the UART_RX_IND pin. More details on this pin usage is explaied down further.

Host uC UART RX --> BM7x HCI_TXD
Host uC UART TX --> BM7x HCI_RXD
Host uC Output GPIO --> BM7x RST_N
Host uC Output GPIO --> BM70 WAKEUP_PIN / BM71 UART_RX_IND

UART Settings

By default the BM7x uses the following settings
Baud Rate: 115200
Data Bits: 8
Parity: None
Stop Bits: 1
Flow Control: None

BM71 P1_6 (UART_RX_IND Pin)

http://microchipdeveloper.com/ble:bm71-app-example-gap-peripheral-demo-making-connections
If you are using the BM71 module, you may need to have a connection from P1_6 of the BM71 module, to a GPIO output of your host uC.. As described in Section 4 within the above link, if the UART_RX_IND is "ENABLED" in configuration, then the BM71 will disable its UART TX pin, and place itself into a low power state. If you wish to talk to the BM71 module, you must first pull the UART_RX_IND pin low for at least ~3ms before beginning transmission. NOTE: This is only necessary when attempting to send OPT code commands while the module is in its App mode. This is not needed for configuration mode.

BM7x Flash Update using Host uC

Now the good stuff. All of Microchips demos provided at the link above, show configuration of the BM7x being done via a tool that runs on a PC. This tool also has the support for updating the flash of the BM7x when connected via a Serial connection. This is not very convenient if you have a compact embedded system, or desire the ability to update configuration of a device already deployed in the field. The great part is, the commands that the tool sends are nothing special, and all of them are documented. So there is no reason we can't send the exact same configurations from a host uC instead. The only trouble is getting the configuration file into the uC. The process we will follow can be seen below.

  • Generate BM7x Configuration using the PC tool provided by Microchip
  • Input the generated confiugration text file into XX (REPLACE THIS WITH THE SOFTWARE TOOL!!)
  • Place generated C configure structure into source code header file
  • Implemented FlashUpdate source into uC
  • Run uC to update Flash

The basic flow of the source code provided in the code section is seen below

  • Place BM7x Into Configuration Mode
  • Open Flash Access
  • Read out Flash Config
  • Check read flash against the configuration stored in our header file
  • If it matches, then return. We are complete since the current config matches what we have
  • If not, Erase Flash Config of BM7x
  • Write new Flash Config
  • Read Flash Config and verify it matches what we just wrote
  • Flash Updated!

This is a high level overview of the firmware. I would be more than happy to assist anyone with issues they may have. Please do not contact me directly with questions, feedback, or comments. Please use the Issues tab of this repo so others can benefit and contribute to any feedback or issues you may have.

Thanks!

About

Microchip BM70 and BM71 Flash update using only a host uC UART connection

License:MIT License