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

drivers/at24cxxx: Add M24C01 device and enhance documentation #20588

Merged
merged 2 commits into from
Apr 17, 2024

Conversation

crasbe
Copy link
Contributor

@crasbe crasbe commented Apr 16, 2024

Contribution description

This PR adds the ST M24C01 I2C EEPROM to the predefined constants in the at24cxxx driver. Since it is the first non-Atmel/Microchip device, the documentation has been enhanced to make clear the driver is not exclusively for devices from Atmel/Microchip.

Furthermore, documentation has been added to make using the driver easier (via pseudomodules) and a small example how to initialize the EEPROM device with the given data structures.

Testing procedure

The code has been tested with the Nordic nRF52840-DK and an ST M24C01WP EEPROM as shown in Issue #20202 with the example code and Makefile given in this issue.

The expected impact on other parts of RIOT is low, since only features have been added which concentrate on the at24cxxx driver which do not affect other parts.
A global driver pseudomodule with the filter "m24c%" has been added similar to the existing "at24c%" pseudomodule to give access to all ST devices that will potentially be added in the future. Currently this filter does not cause any namespace conflicts.

Issues/PRs references

This PR fixes Issue #20202. Please do not merge until the question about the documentation grouping has been answered!

@github-actions github-actions bot added the Area: drivers Area: Device drivers label Apr 16, 2024
@github-actions github-actions bot added Platform: MSP Platform: This PR/issue effects MSP-based platforms Area: network Area: Networking Area: tools Area: Supplementary tools Area: boards Area: Board ports Platform: ESP Platform: This PR/issue effects ESP-based platforms Area: CoAP Area: Constrained Application Protocol implementations Area: cpu Area: CPU/MCU ports Area: sys Area: System labels Apr 16, 2024
@crasbe
Copy link
Contributor Author

crasbe commented Apr 16, 2024

I screwed this up. Sorry.

@crasbe crasbe marked this pull request as draft April 16, 2024 16:01
@github-actions github-actions bot removed Platform: MSP Platform: This PR/issue effects MSP-based platforms Area: network Area: Networking Area: tools Area: Supplementary tools Area: boards Area: Board ports Platform: ESP Platform: This PR/issue effects ESP-based platforms Area: CoAP Area: Constrained Application Protocol implementations Area: cpu Area: CPU/MCU ports Area: sys Area: System labels Apr 16, 2024
@crasbe
Copy link
Contributor Author

crasbe commented Apr 16, 2024

Okay. So I learned about the importance of using different branch names when working with PRs today. I'm sorry that I unneccesarily pinged four people with this. The reviewers which are now added are not the code owners I think.

I fixed it now and the changed files and commits reflect the PR I want to make.

Again, I am very sorry for causing any trouble.

@crasbe crasbe marked this pull request as ready for review April 16, 2024 16:11
@benpicco benpicco added the Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation label Apr 16, 2024
@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Apr 16, 2024
Copy link
Contributor

@benpicco benpicco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't worry, GitHub seems to have sorted it out already.

The additions looks simple enough, thank you for taking care of also enhancing the doc!

@benpicco benpicco requested review from maribu and fabian18 April 16, 2024 20:06
Copy link
Member

@maribu maribu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! ❤️

@riot-ci
Copy link

riot-ci commented Apr 16, 2024

Murdock results

✔️ PASSED

251b525 drivers/at24cxxx: add documentation about driver usage

Success Failures Total Runtime
10045 0 10045 12m:08s

Artifacts

@crasbe
Copy link
Contributor Author

crasbe commented Apr 16, 2024

I just noticed that the at24cxxx module actually has a test file which can be run: https://github.com/RIOT-OS/RIOT/tree/master/tests/drivers/at24cxxx

I'll run the test and post the results first thing tomorrow.

@crasbe
Copy link
Contributor Author

crasbe commented Apr 17, 2024

All tests compiled and ran successfully :)

I'll open a separate issue about the documentation grouping separate from this PR, so from my side it is go for merge.

chris@ThinkPias:~/flashdev-riot/RIOT/tests/drivers/at24cxxx$ AT24CXXX_DEV=m24c01 BOARD=nrf52dk make -j10 hexfile
"make" -C /home/chris/flashdev-riot/RIOT/pkg/cmsis/ 
"make" -C /home/chris/flashdev-riot/RIOT/boards/common/init
"make" -C /home/chris/flashdev-riot/RIOT/boards/nrf52dk
"make" -C /home/chris/flashdev-riot/RIOT/core
"make" -C /home/chris/flashdev-riot/RIOT/core/lib
"make" -C /home/chris/flashdev-riot/RIOT/cpu/nrf52
"make" -C /home/chris/flashdev-riot/RIOT/drivers
"make" -C /home/chris/flashdev-riot/RIOT/sys
"make" -C /home/chris/flashdev-riot/RIOT/boards/common/nrf52xxxdk
"make" -C /home/chris/flashdev-riot/RIOT/drivers/at24cxxx
"make" -C /home/chris/flashdev-riot/RIOT/drivers/periph_common
"make" -C /home/chris/flashdev-riot/RIOT/sys/auto_init
"make" -C /home/chris/flashdev-riot/RIOT/sys/div
"make" -C /home/chris/flashdev-riot/RIOT/cpu/cortexm_common
"make" -C /home/chris/flashdev-riot/RIOT/cpu/nrf52/periph
"make" -C /home/chris/flashdev-riot/RIOT/cpu/nrf52/vectors
"make" -C /home/chris/flashdev-riot/RIOT/sys/frac
"make" -C /home/chris/flashdev-riot/RIOT/sys/libc
"make" -C /home/chris/flashdev-riot/RIOT/sys/malloc_thread_safe
"make" -C /home/chris/flashdev-riot/RIOT/sys/newlib_syscalls_default
"make" -C /home/chris/flashdev-riot/RIOT/sys/preprocessor
"make" -C /home/chris/flashdev-riot/RIOT/sys/stdio
"make" -C /home/chris/flashdev-riot/RIOT/cpu/cortexm_common/periph
"make" -C /home/chris/flashdev-riot/RIOT/cpu/nrf5x_common
"make" -C /home/chris/flashdev-riot/RIOT/cpu/nrf5x_common/periph
"make" -C /home/chris/flashdev-riot/RIOT/sys/stdio_uart
"make" -C /home/chris/flashdev-riot/RIOT/sys/ztimer     

chris@ThinkPias:~/flashdev-riot/RIOT/tests/drivers/at24cxxx$ nrfjprog --recover && nrfjprog --chiperase --verify --program bin/nrf52dk/tests_at24cxxx.hex && nrfjprog --pinresetenable &
& nrfjprog --pinreset
Recovering device. This operation might take 30s.
Erasing user code and UICR flash areas.
Writing image to disable ap protect.
[ #################### ]   0.047s | Erase file - Done erasing                                                          
[ #################### ]   0.284s | Program file - Done programming                                                    
[ #################### ]   0.104s | Verify file - Done verifying                                                       
Enabling pin reset.
Applying pin reset.

chris@ThinkPias:~/flashdev-riot/RIOT/tests/drivers/at24cxxx$ make term
/home/chris/flashdev-riot/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "115200"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2024-04-17 10:33:41,653 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2024-04-17 10:33:45,950 # main(): This is RIOT! (Version: 2024.04-devel-656-g251b52)
2024-04-17 10:33:45,954 # Starting tests for module at24cxxx
2024-04-17 10:33:45,955 # EEPROM size: 128 byte
2024-04-17 10:33:45,956 # Page size  : 16 byte
2024-04-17 10:33:45,959 # [SUCCESS] at24cxxx_init
2024-04-17 10:33:45,962 # [SUCCESS] at24cxxx_write_byte
2024-04-17 10:33:45,965 # [SUCCESS] at24cxxx_read_byte
2024-04-17 10:33:45,967 # [SUCCESS] write_byte/read_byte
2024-04-17 10:33:45,973 # [SUCCESS] at24cxxx_write
2024-04-17 10:33:45,977 # [SUCCESS] at24cxxx_read
2024-04-17 10:33:45,978 # [SUCCESS] write/read
2024-04-17 10:33:45,985 # [SUCCESS] at24cxxx_set
2024-04-17 10:33:45,989 # [SUCCESS] set/read
2024-04-17 10:33:45,992 # Finished tests for module at24cxxx
/exit
2024-04-17 10:33:50,579 # Exiting Pyterm

@maribu maribu added this pull request to the merge queue Apr 17, 2024
Merged via the queue into RIOT-OS:master with commit 8cff167 Apr 17, 2024
29 checks passed
@maribu
Copy link
Member

maribu commented Apr 17, 2024

Thx for the PR!

If I'm correct this is your first PR you got upstream in this repo, correct?

If so: Congratulations 🎉 and welcome to the community!

@crasbe
Copy link
Contributor Author

crasbe commented Apr 17, 2024

@maribu Actually it is my third PR that got merged (#20439 and #20440 were the first two). But thank you nevertheless :)

We have a project that uses RIOT, so it's certainly not going to be the last one (in fact there is still a big one in progress right now and I have enough ideas for further PRs).

@maribu
Copy link
Member

maribu commented Apr 17, 2024

Cool 🚀 I'm looking forward to it :)

@mguetschow mguetschow added this to the Release 2024.07 milestone Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: drivers Area: Device drivers CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants