Skip to content

Commit c69f0e4

Browse files
zicevadpgeorge
authored andcommitted
samd/samd_qspiflash: Correct QSPI baud calculation.
The QSPI baud is derived from the AHB clock, not from the APB (peripheral) clock. Datasheet: The QSPI Baud rate clock is generated by dividing the module clock (CLK_QSPI_AHB) by a value between 1 and 255. As previously implemented, all baudrates are 2.5 times greater than expected. Signed-off-by: I. Tomita <[email protected]>
1 parent 70b95d8 commit c69f0e4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ports/samd/samd_qspiflash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ static void wait_for_flash_ready(void) {
238238
}
239239

240240
static uint8_t get_baud(int32_t freq_mhz) {
241-
int baud = get_peripheral_freq() / (freq_mhz * 1000000) - 1;
241+
int baud = get_cpu_freq() / (freq_mhz * 1000000) - 1;
242242
if (baud < 1) {
243243
baud = 1;
244244
}

0 commit comments

Comments
 (0)