fpga config: fix spi transmission

This commit is contained in:
occheung 2020-09-17 10:21:50 +08:00
parent 4d73786880
commit 89f9b48073

View File

@ -1,8 +1,9 @@
#![no_main] #![no_main]
#![no_std] #![no_std]
#[macro_use]
extern crate log; extern crate log;
use log::debug;
use stm32h7xx_hal::hal::digital::v2::{ use stm32h7xx_hal::hal::digital::v2::{
InputPin, InputPin,
OutputPin, OutputPin,
@ -108,19 +109,13 @@ fn main() -> ! {
// Drive SPI_SS_B low // Drive SPI_SS_B low
fpga_ss.set_low().unwrap(); fpga_ss.set_low().unwrap();
let config_data = include_bytes!("../build/top.bin");
fpga_cfg_spi.transfer(&config_data).unwrap();
// Send the whole image without interruption // Send the whole image without interruption
// let base_address = 0x08100000; let config_data = include_bytes!("../build/top.bin");
// let size = 135100;
// for index in 0..size { for byte in config_data.into_iter() {
// unsafe { block!(fpga_cfg_spi.send(*byte)).unwrap();
// let data :u8 = ptr::read_volatile((base_address + index) as *const u8); block!(fpga_cfg_spi.read()).unwrap();
// block!(fpga_cfg_spi.send(data)).unwrap(); }
// block!(fpga_cfg_spi.read()).unwrap();
// }
// }
// Drive SPI_SS_B high // Drive SPI_SS_B high
fpga_ss.set_high().unwrap(); fpga_ss.set_high().unwrap();