Skip to content

Commit 929d6da

Browse files
committed
esp32s2: cam.c: work around possible compiler bug
1 parent 8c88ab8 commit 929d6da

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

ports/esp32s2/cam.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,18 @@ static void cam_config(const cam_config_t *config) {
106106
periph_module_enable(PERIPH_I2S0_MODULE);
107107

108108
/*!< Configure the clock */
109+
#if 0
109110
I2S0.clkm_conf.val = 0;
110-
I2S0.clkm_conf.clkm_div_num = 2;
111+
I2S0.clkm_conf.clkm_div_num = 2; // <--- this should set the low 8 bits, but doesn't somehow
111112
I2S0.clkm_conf.clkm_div_b = 0;
112113
I2S0.clkm_conf.clkm_div_a = 0;
113114
I2S0.clkm_conf.clk_sel = 2;
114115
I2S0.clkm_conf.clk_en = 1;
115-
116+
#else
117+
// The above code should set the clock to this value .. however, it sets it to 0x0050_0000 instead, the "clkm_div_num" value missing!
118+
// it's not clear why this behavior arises
119+
I2S0.clkm_conf.val = 0x00500002;
120+
#endif
116121
/*!< Configuration sampling rate */
117122
I2S0.sample_rate_conf.val = 0;
118123
I2S0.sample_rate_conf.tx_bck_div_num = 2;

0 commit comments

Comments
 (0)