在对SPI进行初始化时,配置SPIFMT寄存器,设置时钟频率为 ***->cfgFmt->freq=2000000,
#define SPI0_MOD_CLK 100000000
prescaler = ((SPI0_MOD_CLK / ***->cfgFmt->freq) - 1) & 0xFF);//100000000
但是实际测量的SPI时钟频率为3.8Mhz,这是什么原因。
15-8 | PRESCALE | 2h-FFh | SPI prescaler. It determines the bit transfer rate if the SPI is the network master and is directly derived from the SPI module clock. If the SPI is configured as slave, PRESCALE needs to be configured to a valid value, but PRESCALE is ignored. The clock rate can be calculated as: SPI clock frequency = SPI module clock/(PRESCALE + 1) Note: PRESCALE values less than 2h are not supported |
PRESCALE配置时,SPI module clock是直接定义还是需要配置其他时钟?