DheerajSingh1107 opened a new pull request, #18802:
URL: https://github.com/apache/nuttx/pull/18802

   ## Summary
   
   This PR adds a new SPI-based magnetic encoder driver for the AMS AS5047D.
   
   The AS5047D is a 14-bit on-axis magnetic rotary encoder that communicates 
over SPI and is commonly used in motor control and robotics applications 
requiring precise angular position feedback.
   
   This driver provides:
   
   * 14-bit angular position readout (0–16383)
   * SPI communication interface compatible with NuttX SPI framework
   * Basic error detection using status bits from the device
   
   The implementation follows existing NuttX sensor driver patterns and is 
designed to be reusable across supported boards.
   ---
   
   ## Impact
   
   * **New Feature**: Adds support for AS5047D encoder
   * **No breaking changes**: Existing drivers and subsystems are unaffected
   * **Hardware**: Requires an SPI interface (tested on STM32F4 SPI3)
   * **Build**: Adds a new driver option (must be enabled via config)
   * **Use case**: Motor control, robotics, FOC systems requiring precise angle 
feedback
   
   No impact on existing APIs or backward compatibility.
   ---
   ## Testing
   
   Tested on:
   
   * **Board**: STM32F446re (SPI3)
   * **Setup**: AS5047D connected via SPI with proper CS handling
   
   ### Test Procedure:
   
   1. Initialized SPI bus and driver in NuttX
   2. Performed continuous angle reads
   3. Verified:
   
      * Stable 14-bit output range (0–16383)
      * No constant or stuck values
      * Correct response to shaft rotation
   4. Checked error flags in returned data
   Observations:
    * Angle values update correctly with rotation
    * No communication faults observed under normal operation
    * Timing adjustments were required for stable SPI reads
   Logs (example):
   <img width="191" height="704" alt="image" 
src="https://github.com/user-attachments/assets/06d2fbc1-3c11-4f20-8f18-fe1560859122";
 />
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to