In my last blog, I introduced my idea of creating a Gesture controlled FM Radio. The basic idea is to send the gesture results from the MAX32620FTHR board to an Arduino over UART and then control the TEA5767 chip interfaced with the Arduino.
Firmware Framework from Maxim Integrated
By default, the custom firmware inside the MAX32620FTHR board has Serial API implemented over USB. However, the app note by Maxim MAXIM GESTURE SENSOR EVKIT SERIAL API mentions that custom binary is available for UART Serial API. Maxim provides a firmware framework which contains the code for the MAX25405 gesture sensor interface with the MAX32620FTHR board compiled using mbed. After reading the brief documentation in the readme file of the firmware framework, it is noted that the interface.h header file contains a MACRO to implement the Serial API over USB or UART depending on the value of the MACRO.
// Option to implement serial API over UART instead of USB
#define USE_UART_INTERFACE 1
#define UART_BAUD_RATE 115200
For quick experimentation, I changed the value of the MACRO to 1 which enables the Serial API over UART and compiled it using the online mbed compiler.
It gave too many errors. As the code is pretty old and was not meant for the latest mbed os release. I'm still new to mbed so I thought of taking help from our community members.
After initial few tries, I posted a discussion forum on the e14 community which can be found here Establishing serial communication over UART instead of USB in MAX25405 EVKIT two members from our community BigG and misaz were very helpful in providing me plenty of insights into the mbed compiler and helped with me successfully compiling the firmware framework code from Maxim.
Here are the issues I faced while compiling the code and their solutions (which can also be found in the above discussion). I'm posting them here for a quick look and so that other challengers could benefit from them
1. The mbed os issue
The firmware framework code uses many old/deprecated functions that are not supported by the latest release of the mbed-os. So there is a need to find the correct version of mbed-os in order to successfully compile the code. Misaz did some research and found the git commit id for the correct version of mbed which when imported into the firmware framework, compiled the code without any errors.
git checkout 0fdfcf7350896a9c0b57c4a18237677abfe25f1a
Now that compiling problem was solved, there was another issue of programming the MAX32620FTHR board.
2. Timeout error while flashing
The board comes with a bootloader and the compiled binary file can be directly dragged and dropped onto the MAX32620FTHR board. However, when I tried to flash the board with the binary, it gave timeout error. Here, BigG helped by making the changes in the mbed_app.json file which contains the memory setting for the MAX32620FTHR flash.
BigG correctly pointed out where we were going wrong, and he also helped by providing some simple examples for UART connections.
{
"requires": ["bare-metal"],
"config": {
"main-stack-size": {
"value": 65536
}
}
}
So both the problems are now solved.
Prepping the board and connectors
The next step was to test the UART connection. For this, I used a FTDI FT232 based USB to UART converter and connected the MAX32620FTHR board with it.
The MAX32620FTHR board in the evaluation kit for the MAX25405 gesture sensor comes with a shield. The JP5 on the shield is connected with the UART pins of the MAX32620FTHR board. So, I soldered a 3-pin header to the shield to access the UART pins from the shield using some jumpers.
Then I made a custom connector to plug into the FT232 converter and the shield.
Experiments and Tests
Then it was time to test if the compiled firmware works or not. I did the connections as shown in the diagram below
The I opened up Putty and used the serial connection at 115200 baud rate. The putty terminal successfully connected with the MAX32620FTHR board and then I tested some of the commands that are also given in the app note above.
For the first test, I sent the "ver" command followed by "\n" (press Ctrl+J in putty for \n).
I received the firmware framework version output
Next, I tried the "ping" command which gave "ACK" output as expected.
If you send a wrong command, it gives you an error: Invalid Command
Now it was time to test the "poll" command which should give us the gesture results.
However, when I sent the poll command, the output was all 0's and the firmware code just crashes. It does not accept any further commands.
Now the next task is to debug the firmware framework from Maxim and check why the firmware is crashing.
For that I have purchased the MAX32625PICO board. I will do some debugging and report in the next blog. Meanwhile I will also start working on the TEA5767 FM radio chip interface with Arduino and designing a 3-D printed case for the project.
Thanks for reading through my experiments. See you in the next blog!