element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Experimenting with Gesture Sensors
  • Challenges & Projects
  • Design Challenges
  • Experimenting with Gesture Sensors
  • More
  • Cancel
Experimenting with Gesture Sensors
Forum Establishing serial communication over UART instead of USB in MAX25405 EVKIT
  • Challenge Blog
  • Forum
  • Documents
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Experimenting with Gesture Sensors requires membership for participation - click to join
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 89 replies
  • Subscribers 41 subscribers
  • Views 8996 views
  • Users 0 members are here
  • MAX25405
  • gesture sensors
  • maxim integrated
  • uart
  • max32620fthr
Related

Establishing serial communication over UART instead of USB in MAX25405 EVKIT

rsjawale24
rsjawale24 over 2 years ago

The MAX25405EVKIT comes with a MAX32620FTHR board which is preprogrammed with custom binary file for the gesture recognition. The application note at Maxim Gesture Sensor EVKit Serial API (maximintegrated.com)

mentions "The serial interface can be implemented over the Universal Serial Bus (USB) virtual serial port or over a Universal Asynchronous Receiver-Transmitter (UART). The EV kit is shipped configured to use the USB serial port to work with the EV kit PC Graphical user Interface (GUI). If a UART serial interface is desired, custom firmware in binary format is available."

Upon researching more, I found the firmware_framework code that contains the code for gesture recognition compiled using mbed compiler.

The readme file says that a file called interface.h and interface.c define the communication protocol. When I open the interface.c file, I can see a comment in the code that says Option to implement serial API over UART instead of USB but there is only a MACRO set as #define macro_name 0 

I tried to change the 0 to 1 and compile the code, however, it does not compile successfully. The USBDevice library shows some error while compiling. 

Did anyone try to change the serial API over UART instead of USB? Was it successful?  

EDIT: I have successfully compiled the code for UART. However, I'll do some experiments and write introductory blogs before I re-program the MAX32620FTHR board with my firmware. 

  • Sign in to reply
  • Cancel

Top Replies

  • misaz
    misaz over 2 years ago in reply to misaz +4
    Today I found root cause of the issue. Issue is caused by invalid assembly code generated by modern ARM compiler. With older GCC compiler it works because it handle undefined behaviour used in code differently…
  • misaz
    misaz over 2 years ago +3
    I am curious how did you successfully compiled non-changed code? I started working with latest mbed-os but I was unable to compile it (missing toolchain) no matter of USE_UART_INTERFACE setting. Later…
  • BigG
    BigG over 2 years ago in reply to rsjawale24 +3
    I've create a very basic stripped down library based on the firmware framework using the latest MbedOS 6.16. github.com/.../Max25x05_MbedOS6 All it is doing is getting the raw pixel data. It is doing…
Parents
  • misaz
    misaz over 2 years ago

    I am curious how did you successfully compiled non-changed code? I started working with latest mbed-os but I was unable to compile it (missing toolchain) no matter of USE_UART_INTERFACE setting. Later I found some other issues on internet and general recommendation is downgrade mbed-os because Maxim do not update their codes to last mbed-os and their codes currently do not work with latest mbed-os. After downgrading I was able to successfully compile with USE_UART_INTERFACE set to both 0 and 1.

    I compiled this using following steps. Especially see git checkout which downgrades the mbed-os and description for vim commands in which I had to fix one old py file to work with latest python libraries.

    sudo apt update
    sudo apt install python3 python3-pip git mercurial
    python3 -m pip install mbed-cli
    
    unzip firmware_framework.zip
    rm firmware_framework.zip
    mbed new .
    mbed add https://os.mbed.com/teams/MaximIntegrated/code/MAX32620FTHR/
    mbed add https://os.mbed.com/teams/MaximIntegrated/code/USBDevice/
    
    # add main stack limit section according to readme.txt
    vim mbed_app.json
    
    # download ARM GNU Toolchain from https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads
    tar -xf arm-gnu-toolchain-12.2.mpacbti-bet1-x86_64-arm-none-eabi.tar.xz
    export MBED_GCC_ARM_PATH=/home/michal/armgcc/arm-gnu-toolchain-12.2.mpacbti-bet1-x86_64-arm-none-eabi/bin
    
    cd mbed-os
    git checkout 0fdfcf7350896a9c0b57c4a18237677abfe25f1a
    
    # in following vim window change following line:
    #
    # from collections import namedtuple, Mapping
    #
    # to followiong two lines:
    #
    # from collections import namedtuple
    # from collections.abc import Mapping
    
    vim "/home/michal/max25405fw/mbed-os/tools/targets/__init__.py"
    
    mbed compile -m MAX32620FTHR -t GCC_ARM

    After this I was able to get firmware compiled with both USE_UART_INTERFACE=0 and 1. I currently do not have enough time to test built firmwares. I will test them next weekend. Before flashing I recommend backuping stock firmware. I have not checked on this yet but Maxim usually do not lock MCU for prevent reading stock firmware, so you should be able to download stock firmware from MCU before flashing custom firmware. You should be able to do this using JTAG probe and openocd. Note that vanilla/mainline openocd usually do not work with Maxim MCUs (or at least It never work on my machine and chip). Use their patched openocd which is available as part of their SDKs available at pages of MCUs. As I said, currently I have no time to test it, but next week I will try it and give you better feedback.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Cancel
  • rsjawale24
    rsjawale24 over 2 years ago in reply to misaz

    Hi misaz!

    Thank you for the detailed response. I don't have JTAG and my idea involved communication over UART so I guess I have no other option.

     I did face a few problems while compiling the code as provided by Maxim. 

    I haven't used mbed CLI. I used the mbed online compiler. Just imported the framework to the online compiler and added other required libraries such as the FTHR board files. There were quite a few errors about serial communication and a non void function returning a value. Had fix it up. I flashed my FTHR board with the new binary file and interfaced it with Arduino to read data serially. 

    All I got on the Arduino serial monitor was a value of 240. Not sure what that means. Will have to read the documentation

    It's past midnight now Sunday is already over so I left it as it is. I will look into it tomorrow or next weekend.

    Again, thanks for the tip on retrieving stock firmware. Will try it with some other boards as I've never tried that before.

    Any recommendations on JTAG device? I believe the STM32 discovery board has a JTAG PCB attached to it? Can that be used as a JTAG for other MCUs?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • misaz
    misaz over 2 years ago in reply to rsjawale24

    You do not need JTAG if you just need to flash firmware. MCU is preprogrammed with bootloader. Hold BOOT button before when connecting USB to computer and device will boot to bootloader and you can drag and drop new firmware.

    I am not sure, but I think that bootloader do not support reading firmware back by any way, so if you want to backup stock firmware then you need to use JTAG probe.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • misaz
    misaz over 2 years ago in reply to rsjawale24

    You do not need JTAG if you just need to flash firmware. MCU is preprogrammed with bootloader. Hold BOOT button before when connecting USB to computer and device will boot to bootloader and you can drag and drop new firmware.

    I am not sure, but I think that bootloader do not support reading firmware back by any way, so if you want to backup stock firmware then you need to use JTAG probe.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
Children
  • rsjawale24
    rsjawale24 over 2 years ago in reply to misaz

    Yes, I was asking about JTAG for reading the firmware and keeping a backup. The MCU has a bootloader and can be programmed over usb.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube