From 67e30fa91e12b452c1a18f6c5eb8a33cdb9ec625 Mon Sep 17 00:00:00 2001 From: jaseg Date: Sat, 30 Sep 2023 18:25:10 +0200 Subject: 8b/10b tx/rx works --- driver_fw/src/main.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'driver_fw') diff --git a/driver_fw/src/main.c b/driver_fw/src/main.c index 52b4a4d..0b3c869 100644 --- a/driver_fw/src/main.c +++ b/driver_fw/src/main.c @@ -202,6 +202,9 @@ void dma_tx_constant(size_t table_size, uint16_t constant) { DMA1_Channel1->CCR |= DMA_CCR_EN; } +int8_t bit_arr[4096]; +size_t bit_pos = 0; + void DMA1_Channel1_IRQHandler() { static int transfer_errors = 0; static int current_symbol = 0x2aa; @@ -213,6 +216,10 @@ void DMA1_Channel1_IRQHandler() { DMA1->IFCR = DMA_IFCR_CGIF1; int bit = !!(current_symbol & (1<= 10) { - tx_bitpos = 0; - tx_sympos ++; + if (tx_bitpos == 0) { + tx_bitpos = 9; current_symbol = xfr_8b10b_encode(&encoder_state_8b10b, tx_datagram[tx_sympos]); + tx_sympos ++; if (tx_sympos >= COUNT_OF(tx_datagram)) { tx_sympos = 0; } + } else { + tx_bitpos --; } } -- cgit