Write register not take effect [IDFGH-3226]

frank_he
Posts: 7
Joined: Wed Apr 08, 2020 5:41 am

Write register not take effect [IDFGH-3226]

Postby frank_he » Tue Apr 28, 2020 10:00 am

HI,
I tried to set spi clk configuration by writing the SPI_CLOCK_REG. and then i tried to read it out. and i found it's still a default value of reset. The code is like bellow. Does i missed somewhere before access spi registers?

WRITE_PERI_REG(SPI_CLOCK_REG(SPI_NUM_HSPI),
((0x7 & SPI_CLKDIV_PRE) << SPI_CLKDIV_PRE_S) // Pre-divide by 8 --> 10MHz
| ((0x09 & SPI_CLKCNT_N) << SPI_CLKCNT_N_S) // Further divide by 10 --> 1 MHz
| ((0x04 & SPI_CLKCNT_H) << SPI_CLKCNT_H_S) // = ((SPI_CLKCNT_N+1)/2)-1
| ((0x09 & SPI_CLKCNT_L) << SPI_CLKCNT_L_S)); // = SPI_CLKCNT_N

uint32_t clkcfg = READ_PERI_REG(SPI_CLOCK_REG(SPI_NUM_HSPI));

printf("clkcfg : %u\n",clkcfg);
I get an output of 2147496003 for clkcfg. Can anybody help to have a look at this and give a suggestion?

Thanks very much

Who is online

Users browsing this forum: No registered users and 89 guests