Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arduino Nano 33 IoT large transfer fix (MCU hang bug) #316

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Aug 5, 2023

  1. Arduino Nano 33 IoT large transfer fix (MCU hang bug)

    uint16_t handle = *(uint16_t*)data
    
    hangs Arduino Nano 33 IoT in cases when data pointer is unaligned. This happens when receiving large packets of BLEStringCharacteristic.
    
    This doesn't not happen when setting such characteristics from iPhone (iOS) or Android devices, but happens 100% of the time on PC using either Bleak (Python) or QT6 libraries.
    
    In those cases data pointer at the time of this call is not two bytes (sizeof(uint16_t)) aligned and dereferencing such pointer hangs the MCU.
    
    To resolve the issue we copy that uint16_t handle byte by byte without monkeying with ORs, Shifts or other binary operations to avoid endianness issues on other platforms.
    coderand authored Aug 5, 2023
    Configuration menu
    Copy the full SHA
    18fd367 View commit details
    Browse the repository at this point in the history