arduino / arduino/ArduinoCore-renesas

R7FA4M1AB.h GTCR_b.TPCS definition is off by one bit

Open
#531 0 comments 0 reactions 0 assignees View on GitHub
topic: infrastructure type: imperfection
Dominant language
C
Stars
193
Forks
112
PR merge metrics
No merged PRs in 30d

Description

The "Timer Prescaler Select" portion of GTCR should be 3 bits [26..24] per the datasheet, but the header file says that it's 4 bits [26..23]:

https://github.com/arduino/ArduinoCore-renesas/blob/00910fde8314e299a737f617a2c7cbd727b3a545/variants/MINIMA/includes/ra/fsp/src/bsp/cmsis/Device/RENESAS/Include/R7FA4M1AB.h#L5219

```cpp
__IOM uint32_t TPCS : 4; /*!< [26..23] Timer Prescaler Select */
```

Compare to the [RA4M1 group datasheet](https://www.renesas.com/en/document/mah/renesas-ra4m1-group-users-manual-hardware) (page 417).

I did some testing and found that the prescaler works as expected if you shift the value to the left by one bit, and that the value written to b23 cannot be read back. More detail in [this forum thread](https://forum.arduino.cc/t/timer-register-definition-doesnt-match-datasheet/1431402/6).

Contributor guide

No contributing guide indexed for this repository

Research direction

Inspect variants/MINIMA/includes/ra/fsp/src/bsp/cmsis/Device/RENESAS/Include/R7FA4M1AB.h around line 5219, then compare the GTCR.TPCS definition with page 417 of the RA4M1 datasheet. Done means the field covers bits 26..24 as documented and the register behavior matches the reported prescaler and readback observations.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.