ghnotgood opened a new pull request, #18853:
URL: https://github.com/apache/nuttx/pull/18853
Implementation of the Kinetis' Periodic Interrupt Timer (PIT). The lower
half driver is oneshot.
## Summary
Kinetis' PIT is not yet implemented. It is simpler than FlexTimer Module
(FTM) but good enough for oneshot timer-like use cases.
This PR implements Kinetis' PIT using oneshot count-based API.
Please, note that I am not completely sure about the `resolution` parameter
of the `oneshot_initialize` procedure. The frequency of the PIT depends on the
`BOARD_BUS_FREQ` and timing does not work as expected when something different
is used. I am probably missing something and I am happy to fix it when I
understand it. Thank you.
## Impact
Developers can
```
#if defined(CONFIG_ONESHOT)
# if defined(CONFIG_KINETIS_PIT_CH0)
struct oneshot_lowerhalf_s *oneshot0 = oneshot_initialize(0, 0);
if (NULL == oneshot0)
{
syslog(LOG_ERR, "ERROR: PIT0 initialization failed");
}
else
{
ret = oneshot_register("/dev/pit0", oneshot0);
if (OK != ret)
{
syslog(LOG_ERR, "ERROR: PIT0 register failed");
}
}
# endif
#endif
```
and then use `/dev/pit0` as oneshot timer.
## Testing
With the changes to .config
```
CONFIG_KINETIS_PIT=y
CONFIG_KINETIS_PIT_CH0=y
CONFIG_ONESHOT=y
CONFIG_ONESHOT_COUNT=y
CONFIG_EXAMPLES_ONESHOT=y
CONFIG_EXAMPLES_ONESHOT_DEVNAME="/dev/pit0"
```
I have run started our board:
```
__start: Reset status: 00:00
oneshot_register: devname=/dev/pit0 lower=0x1fff0564
NuttShell (NSH) NuttX-12.13.0
```
and run the `oneshot` example:
```
vtk15> oneshot
Oponeshot_ioctl: cmd=5664 arg=1fffa354
ening /deoneshot_ioctl: cmd=5665 arg=1fffa35c
v/pit0
Maximum delay is 71582788
Starting oneshot timer with delay 2000000 microseconds
Waiting...
Finished
vtk15>
```
The delay between `Waiting...` and `Finished` was approximately 2 seconds.
--
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]