Skip to content

driver/at30tse75x: port to ztimer_usec#17137

Merged
kfessel merged 3 commits intoRIOT-OS:masterfrom
kfessel:p-ztimer-at30tse75x
Nov 12, 2021
Merged

driver/at30tse75x: port to ztimer_usec#17137
kfessel merged 3 commits intoRIOT-OS:masterfrom
kfessel:p-ztimer-at30tse75x

Conversation

@kfessel
Copy link
Copy Markdown
Contributor

@kfessel kfessel commented Nov 4, 2021

Contribution description

port at30tse75x-driver to ztimer_usec

Testing procedure

build and run tests/at30tse75x-driver

Issues/PRs references

#17111

@github-actions github-actions bot added the Area: drivers Area: Device drivers label Nov 4, 2021
@kfessel kfessel changed the title P ztimer at30tse75x driver/at30tse75x: port to ztimer_usec Nov 4, 2021
@kfessel kfessel requested review from aabadie and fjmolinas November 4, 2021 13:38
@aabadie
Copy link
Copy Markdown
Contributor

aabadie commented Nov 4, 2021

If you want to test on hardware, this sensor is available on the samr21-xpro boards provided by IoT-LAB (Saclay site only), see https://www.iot-lab.info/docs/boards/microchip-samr21/

@kfessel kfessel force-pushed the p-ztimer-at30tse75x branch from b550f14 to e990bb5 Compare November 4, 2021 16:15
@github-actions github-actions bot added the Area: tests Area: tests and testing framework label Nov 4, 2021
@kfessel kfessel force-pushed the p-ztimer-at30tse75x branch from e990bb5 to 95be6bf Compare November 4, 2021 16:56
@github-actions github-actions bot removed the Area: tests Area: tests and testing framework label Nov 4, 2021
@kfessel
Copy link
Copy Markdown
Contributor Author

kfessel commented Nov 4, 2021

@aabadie: I neither can get the master nor the PR working on the iot-lab.info. I get

at30tse75x init 0
Error initializing AT30TSE75x sensor on I2C #0 @ 0x48

in both cases

@kfessel
Copy link
Copy Markdown
Contributor Author

kfessel commented Nov 4, 2021

@aabadie: test worked the senor is at 0x4f (riot defaults to 0x48)->

main(): This is RIOT! (Version: 2021.10-devel-1178-g1ebd4-p-ztimer-at30tse75x)
AT30TSE75x device driver test
> at30tse75x init 0 0x4f
at30tse75x init 0 0x4f
Initialized AT30TSE75x sensor on I2C #0 @ 0x4f
> at30tse75x read
at30tse75x read
Temperature: 20.500 °C

maybe you are able to change the link to the in the iot-lab documentation to the Microchip IO1 Xplained extension doc mentation is wrong maybe microchips own docu is the right choice

@kfessel kfessel added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Nov 4, 2021
@aabadie
Copy link
Copy Markdown
Contributor

aabadie commented Nov 5, 2021

You forgot to adapt the module dependencies in Kconfig

@github-actions github-actions bot added the Area: Kconfig Area: Kconfig integration label Nov 5, 2021
@fjmolinas
Copy link
Copy Markdown
Contributor

@aabadie: test worked the senor is at 0x4f (riot defaults to 0x48)->

main(): This is RIOT! (Version: 2021.10-devel-1178-g1ebd4-p-ztimer-at30tse75x)
AT30TSE75x device driver test
> at30tse75x init 0 0x4f
at30tse75x init 0 0x4f
Initialized AT30TSE75x sensor on I2C #0 @ 0x4f
> at30tse75x read
at30tse75x read
Temperature: 20.500 °C

maybe you are able to change the link to the in the iot-lab documentation to the Microchip IO1 Xplained extension doc mentation is wrong maybe microchips own docu is the right choice

Is

#ifndef IO1_XPLAINED_PARAM_ADDR
#define IO1_XPLAINED_PARAM_ADDR (0x07)
#endif

correct then?

Copy link
Copy Markdown
Contributor

@fjmolinas fjmolinas left a comment

Choose a reason for hiding this comment

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

Tested, seems to work fine:
BOARD=samr21-xpro make -C tests/driver_io1_xplained/ flash term -j

2021-11-05 11:27:50,172 # SD Card CID info:
2021-11-05 11:27:50,173 # MID: 3
2021-11-05 11:27:50,173 # OID: SD
2021-11-05 11:27:50,173 # PNM: DSU04
2021-11-05 11:27:50,174 # PRV: 128
2021-11-05 11:27:50,174 # PSN: 4012115276
2021-11-05 11:27:50,174 # MDT: 252
2021-11-05 11:27:50,175 # CRC: 177
2021-11-05 11:27:50,175 # +----------------------------------------+
2021-11-05 11:27:50,176 # 
2021-11-05 11:27:51,155 # Light level: 0
2021-11-05 11:27:51,159 # +-------------------------------------+
2021-11-05 11:27:56,196 # Temperature [°C]: 23.312
2021-11-05 11:27:56,200 # +-------------------------------------+
2021-11-05 11:27:57,208 # SD Card CID info:
2021-11-05 11:27:57,209 # MID: 3
2021-11-05 11:27:57,209 # OID: SD
2021-11-05 11:27:57,210 # PNM: DSU04
2021-11-05 11:27:57,211 # PRV: 128
2021-11-05 11:27:57,213 # PSN: 4012115276
2021-11-05 11:27:57,214 # MDT: 252
2021-11-05 11:27:57,214 # CRC: 177
2021-11-05 11:27:57,218 # +----------------------------------------+
2021-11-05 11:27:57,219 # 
2021-11-05 11:27:58,226 # Light level: 0
2021-11-05 11:27:58,230 # +-------------------------------------+
2021-11-05 11:28:03,267 # Temperature [°C]: 23.187
2021-11-05 11:28:03,271 # +-------------------------------------+
2021-11-05 11:28:04,279 # SD Card CID info:
2021-11-05 11:28:04,280 # MID: 3
2021-11-05 11:28:04,281 # OID: SD
2021-11-05 11:28:04,282 # PNM: DSU04
2021-11-05 11:28:04,282 # PRV: 128
2021-11-05 11:28:04,284 # PSN: 4012115276
2021-11-05 11:28:04,285 # MDT: 252
2021-11-05 11:28:04,286 # CRC: 177
2021-11-05 11:28:04,290 # +----------------------------------------+
2021-11-05 11:28:04,290 # 
2021-11-05 11:28:05,298 # Light level: 0
2021-11-05 11:28:05,301 # +-------------------------------------+

@fjmolinas fjmolinas removed the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Nov 5, 2021
@kfessel
Copy link
Copy Markdown
Contributor Author

kfessel commented Nov 5, 2021

Is

#ifndef IO1_XPLAINED_PARAM_ADDR
#define IO1_XPLAINED_PARAM_ADDR (0x07)
#endif

correct then?

Yes, I just wasn't using saul which lead me to search ....

@kfessel kfessel force-pushed the p-ztimer-at30tse75x branch from a5fe74b to 314bc00 Compare November 5, 2021 11:20
@kfessel kfessel added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Nov 5, 2021
Copy link
Copy Markdown
Contributor

@fjmolinas fjmolinas left a comment

Choose a reason for hiding this comment

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

ACK!

@kfessel kfessel removed the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Nov 5, 2021
@kfessel
Copy link
Copy Markdown
Contributor Author

kfessel commented Nov 5, 2021

https://ci.riot-os.org/RIOT-OS/RIOT/17137/314bc0090278e175705e06910d82f3e40a6d5430/output/compile/tests/driver_io1_xplained/samr21-xpro:gnu.txt

moddif.txt
samr21-xpro gnu.txt

Seems like this rule isn't in KConfig:

# unless ztimer_xtimer_compat is used, make xtimer use ztimer_usec as backend.
ifneq (,$(filter ztimer_periph_timer,$(USEMODULE)))
ifneq (,$(filter xtimer,$(USEMODULE)))
ifeq (,$(filter ztimer_xtimer_compat,$(USEMODULE)))
USEMODULE += xtimer_on_ztimer
endif
endif
ifneq (,$(filter evtimer,$(USEMODULE)))
USEMODULE += evtimer_on_ztimer
endif
endif

@github-actions github-actions bot added the Area: tests Area: tests and testing framework label Nov 5, 2021
@kfessel kfessel force-pushed the p-ztimer-at30tse75x branch from f3792bf to 4ebb099 Compare November 5, 2021 16:36
@kfessel
Copy link
Copy Markdown
Contributor Author

kfessel commented Nov 5, 2021

I am not sure i this is the way i am supposed to solve that (I would think there is some kind of Automatisation to try to get a working configuration for xtimer but it seem like "No")

@kfessel kfessel added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Nov 5, 2021
@fjmolinas
Copy link
Copy Markdown
Contributor

I am not sure i this is the way i am supposed to solve that (I would think there is some kind of Automatisation to try to get a working configuration for xtimer but it seem like "No")

@leandrolanzieri is this one of the corner cases where we match configuration to match in the test application or is it something to be fixed in the modeling?

@kfessel
Copy link
Copy Markdown
Contributor Author

kfessel commented Nov 5, 2021

Every kind of trying to auto select the MODULE_XTIMER_ON_ZTIMER failed due to being a loop. (tryed selects with if depend on, if block that include or remove that choiceblock)

Making the choice (of x_on_z or xtimer_compat) non optional would make it allway include one (even if no one need a xtimer interface)

May be it is just the case that we need more explicit choices with KConfig

@leandrolanzieri
Copy link
Copy Markdown
Contributor

@leandrolanzieri is this one of the corner cases where we match configuration to match in the test application or is it something to be fixed in the modeling?

This should be changed in Kconfig modelling. I'm looking into it to provide a fix.

Making the choice (of x_on_z or xtimer_compat) non optional would make it allway include one (even if no one need a xtimer interface)

Yes, we need to make it non optional but also depend on xtimer being there.

@kfessel kfessel force-pushed the p-ztimer-at30tse75x branch from 4ebb099 to 314bc00 Compare November 11, 2021 10:51
@github-actions github-actions bot removed the Area: tests Area: tests and testing framework label Nov 11, 2021
@kfessel
Copy link
Copy Markdown
Contributor Author

kfessel commented Nov 11, 2021

with #17165 in this should work without that last commit

@aabadie
Copy link
Copy Markdown
Contributor

aabadie commented Nov 11, 2021

Retested on IoT-LAB and works. ACK

@benpicco benpicco added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Nov 12, 2021
@kfessel kfessel merged commit 3d33cee into RIOT-OS:master Nov 12, 2021
@fjmolinas fjmolinas added this to the Release 2022.01 milestone Nov 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: drivers Area: Device drivers Area: Kconfig Area: Kconfig integration 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