Compare commits

...

1 Commits

Author SHA1 Message Date
Harry Ho 2da2a91572 examples: Clarify SPI clock selection 2021-09-02 17:13:03 +08:00
2 changed files with 4 additions and 6 deletions

View File

@ -117,7 +117,7 @@ const APP: () = {
.cfgr .cfgr
.sysclk(168.mhz()) .sysclk(168.mhz())
.hclk(168.mhz()) .hclk(168.mhz())
.pclk1(42.mhz()) .pclk2(42.mhz()) // used by SPI1
.require_pll48clk() .require_pll48clk()
.freeze(); .freeze();
let mut delay = Delay::new(c.core.SYST, clocks); let mut delay = Delay::new(c.core.SYST, clocks);
@ -149,7 +149,7 @@ const APP: () = {
let spi_eth_port = Spi::spi1( let spi_eth_port = Spi::spi1(
spi1, (spi1_sck, spi1_miso, spi1_mosi), spi1, (spi1_sck, spi1_miso, spi1_mosi),
enc424j600::spi::interfaces::SPI_MODE, enc424j600::spi::interfaces::SPI_MODE,
Hertz(enc424j600::spi::interfaces::SPI_CLOCK_FREQ), 10_500_000.hz(), // PCLK2 @ 42MHz, set SPI1 baud rate as f_PCLK2 divided by 4
clocks); clocks);
SpiEth::new(spi_eth_port, spi1_nss) SpiEth::new(spi_eth_port, spi1_nss)

View File

@ -49,9 +49,7 @@ const APP: () = {
.cfgr .cfgr
.sysclk(168.mhz()) .sysclk(168.mhz())
.hclk(168.mhz()) .hclk(168.mhz())
//.pclk1(32.mhz()) .pclk2(42.mhz()) // used by SPI1
.pclk1(42.mhz())
//.pclk2(64.mhz())
.require_pll48clk() .require_pll48clk()
.freeze(); .freeze();
let mut delay = Delay::new(c.core.SYST, clocks); let mut delay = Delay::new(c.core.SYST, clocks);
@ -80,7 +78,7 @@ const APP: () = {
let spi_eth_port = Spi::spi1( let spi_eth_port = Spi::spi1(
spi1, (spi1_sck, spi1_miso, spi1_mosi), spi1, (spi1_sck, spi1_miso, spi1_mosi),
enc424j600::spi::interfaces::SPI_MODE, enc424j600::spi::interfaces::SPI_MODE,
Hertz(enc424j600::spi::interfaces::SPI_CLOCK_FREQ), 10_500_000.hz(), // PCLK2 @ 42MHz, set SPI1 baud rate as f_PCLK2 divided by 4
clocks); clocks);
SpiEth::new(spi_eth_port, spi1_nss) SpiEth::new(spi_eth_port, spi1_nss)