-
Hi, I have kind of an obscure question. Driving a Sharp Memory Display with the T41. Normally the display expects SPI at 1-2MHz but when I do SPI at 1-2MHz with T41, the display is missing a lot of lines and the image is generally faded. My experimentation has resulted in noticing the image clarity is perfect and there are no artifacts at 8MHz SPI. However when doing 8MHz SPI, if I invoke Here is the code. I'd love to hear your thoughts. // Also tried this, exact same result.
// let mut disp_spi3 = board::lpspi(lpspi3, board::LpspiPins {
// pcs0:pins.p0,
// sdo: pins.p26,
// sdi: pins.p39,
// sck: pins.p27,
// }, 8_000_000);
let lpspi3 = unsafe { bsp::ral::lpspi::LPSPI3::instance() };
lpspi::prepare(&mut pins.p26);
lpspi::prepare(&mut pins.p27);
lpspi::prepare(&mut pins.p39);
lpspi::prepare(&mut pins.p0);
let mut disp_spi3 = imxrt_hal::lpspi::Lpspi::without_pins(lpspi3);
disp_spi3.disabled(|spi| {
spi.set_mode(memory_disp::MODE);
spi.set_clock_hz(LPSPI_FREQUENCY, 8_000_000);
});
let mut disp = MemoryDisplay::new(disp_spi3, gpio1.output(pins.p0), gpio1.output(pins.p1));
disp.clear();
disp.flush_buffer();
disp.enable();
loop {
if pit.is_elapsed() {
if counter_10ms >= 100 {
disp.display_mode();
disp.clear_buffer();
data.clear();
let _ = write!(data, "Uptime: {} sec", counter_1s);
embedded_graphics::text::Text::new(&data, Point::new(60, 90), style).draw(&mut disp).unwrap();
disp.fill_solid(&Rectangle::new(Point::new(30, 100), Size::new(50, 50)), BinaryColor::Off).unwrap();
counter_1s = counter_1s.wrapping_add(1);
disp.flush_buffer();
counter_10ms = 0;
} else {
counter_10ms = counter_10ms.wrapping_add(1);
}
pit.clear_elapsed();
}
// wfi() here or delay of anything more than 19us causes the issue
cortex_m::asm::wfi();
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
The snippet MemoryDisplay::new(disp_spi3, gpio1.output(pins.p0), gpio1.output(pins.p1)); suggests that this driver expects to synchronize the LPSPI controller with software-managed GPIOs. However, we haven't tried to support that kind of synchronization until the 0.5.5 imxrt-hal release. Are you using the 0.5.5 release of imxrt-hal? If not, could you retest with that imxrt-hal release?
This device is designed to work at 1-2MHz SPI SCK? If yes, I'd focus on getting that working. I wouldn't push the bus speed to 8MHz -- 4x to 8x beyond device specifications -- and expect a stable system. |
Beta Was this translation helpful? Give feedback.
-
@mciantyre Thank you for the reply. Updating |
Beta Was this translation helpful? Give feedback.
@mciantyre Thank you for the reply. Updating
imxrt-hal
to0.5.5
addressed the issue observed at the out-of-spec 8MHz and made 1MHz in-spec communication work without an issue as well. It was a very pleasant surprise.