drivers/sensors: Add AS5047D magnetic encoder driver#18802
Open
DheerajSingh1107 wants to merge 1 commit intoapache:masterfrom
Open
drivers/sensors: Add AS5047D magnetic encoder driver#18802DheerajSingh1107 wants to merge 1 commit intoapache:masterfrom
DheerajSingh1107 wants to merge 1 commit intoapache:masterfrom
Conversation
This adds support for the AMS AS5047D SPI magnetic encoder. Features: - 14-bit angle read - SPI interface - basic error handling Tested on STM32F4 with SPI3. Signed-off-by: Dheeraj Singh <Dheerajsingh1107@gmail.com>
acassis
reviewed
Apr 24, 2026
Contributor
There was a problem hiding this comment.
@DheerajSingh1107 thank you for your contribution, please align the CMakelist:
if(CONFIG_SENSORS_AS5047D)
list(APPEND SRCS as5047d.c)
endif()
Contributor
|
Please add documentation for this driver :) |
Contributor
|
@DheerajSingh1107 please take a look at this PR I submitted to MT6816 (#18807) and add a board config to some board you are using with it and Documentation to your AS5047D, this way a new user will be able to get it working easily |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
The implementation follows existing NuttX sensor driver patterns and is designed to be reusable across supported boards.
Impact
No impact on existing APIs or backward compatibility.
Testing
Tested on:
Test Procedure:
Initialized SPI bus and driver in NuttX
Performed continuous angle reads
Verified:
Checked error flags in returned data
Observations:
Logs (example):