Skip to content

Commit

Permalink
tests: pwm_tach: rand_cycles needs to be divisible by 256.
Browse files Browse the repository at this point in the history
The number of cycles must be divisible by 256 in order to obtain an
accurate PWM frequency for the loopback test.

Signed-off-by: Billy Tsai <[email protected]>
Change-Id: I1a26f078af38aeaebb9fabc63b272ce5439217f5
  • Loading branch information
billy-tsai committed Jul 18, 2023
1 parent b46e590 commit eb189d5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/boards/ast1030/src/pwm_tach.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void test_pwm_tach_loopback_accurate(void)

div_l = sys_rand32_get() % 256;
div_h = sys_rand32_get() % 4;
rand_cycles = BIT(div_h) * (div_l + 1);
rand_cycles = BIT(div_h) * (div_l + 1) * 256;
if (rand_cycles < 2) {
rand_cycles = 2;
}
Expand Down

0 comments on commit eb189d5

Please sign in to comment.