compiled, config in src/config, but i get hardfault crash at runtime
This commit is contained in:
@@ -7,29 +7,18 @@ use embassy_executor::Spawner;
|
||||
use embassy_stm32::gpio::{Input, Output, Level, Pull, Speed};
|
||||
use embassy_sync::{blocking_mutex::raw::CriticalSectionRawMutex, pipe::Pipe};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_stm32::dma::{TransferOptions, WritableRingBuffer};
|
||||
use dma_gpio::software_uart::{
|
||||
dma_timer::{init_tim6_for_uart, init_tim7_for_uart},
|
||||
uart_emulation::{Parity, StopBits, UartConfig},
|
||||
gpio_dma_uart_tx::{write_uart_frames_to_ring, TIM6_UP_REQ},
|
||||
gpio_dma_uart_rx::rx_dma_task,
|
||||
debug::dump_tim6_regs,
|
||||
};
|
||||
use embassy_stm32::dma::{TransferOptions, WritableRingBuffer};
|
||||
use dma_gpio::config::{BAUD, TX_PIN_BIT, RX_OVERSAMPLE, TX_OVERSAMPLE, UART_CFG};
|
||||
use dma_gpio::config::{TX_RING_BYTES, RX_RING_BYTES, PIPE_RX_SIZE};
|
||||
use static_cell::StaticCell;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
/// SOFTWARE UART CONFIGURATION
|
||||
const BAUD: u32 = 115_200;
|
||||
const TX_PIN_BIT: u8 = 2; // PA2
|
||||
const TX_OVERSAMPLE: u16 = 1;
|
||||
const RX_OVERSAMPLE: u16 = 16;
|
||||
const RX_RING_BYTES: usize = 4096;
|
||||
const TX_RING_BYTES: usize = 4096;
|
||||
|
||||
// Nemoze by generic, v taskoch treba manualne zmenit
|
||||
// Compiler upozorni, takze ostava takto
|
||||
const PIPE_RX_SIZE: usize = 256;
|
||||
|
||||
static PIPE_RX: Pipe<CriticalSectionRawMutex, PIPE_RX_SIZE> = Pipe::new();
|
||||
static RX_RING: StaticCell<[u8; RX_RING_BYTES]> = StaticCell::new();
|
||||
static TX_RING: StaticCell<[u32; TX_RING_BYTES]> = StaticCell::new();
|
||||
@@ -75,18 +64,12 @@ async fn main(spawner: Spawner) {
|
||||
tx_ring.start();
|
||||
info!("TX DMA ring started");
|
||||
|
||||
let uart_cfg = UartConfig {
|
||||
data_bits: 8,
|
||||
parity: Parity::None,
|
||||
stop_bits: StopBits::One,
|
||||
};
|
||||
|
||||
loop {
|
||||
write_uart_frames_to_ring(
|
||||
&mut tx_ring,
|
||||
TX_PIN_BIT,
|
||||
b"Hello marshmallow\r\n",
|
||||
&uart_cfg,
|
||||
&UART_CFG,
|
||||
)
|
||||
.await;
|
||||
Timer::after(Duration::from_secs(2)).await;
|
||||
|
||||
Reference in New Issue
Block a user