From 1413a0e665da1d1cf1416eeb95e9d4a041e69c32 Mon Sep 17 00:00:00 2001 From: jaseg Date: Wed, 20 Dec 2023 18:05:06 +0100 Subject: Add local changes --- driver_fw/.gdbinit | 18 ++++++++++++------ driver_fw/src/main.c | 35 +++++++++++++++++++++++++++++++---- 2 files changed, 43 insertions(+), 10 deletions(-) (limited to 'driver_fw') diff --git a/driver_fw/.gdbinit b/driver_fw/.gdbinit index a8b0d69..652efda 100644 --- a/driver_fw/.gdbinit +++ b/driver_fw/.gdbinit @@ -1,5 +1,16 @@ -target extended-remote 192.168.1.95:2022 +# blackmagic-1 +# target extended-remote 192.168.27.252:2022 + +# blackmagic-2 +# target extended-remote 192.168.27.114:2022 + +# blackmagic-3 +# target extended-remote 192.168.27.207:2022 + +# blackmagic-4 +target extended-remote 192.168.27.153:2022 + set print pretty on set print elements 512 @@ -18,8 +29,3 @@ end source ~/ref/PyCortexMDebug/cmdebug/svd_gdb.py svd_load ~/ref/stm32square/svd/STM32G070.svd -define reconnect - disconnect - target extended-remote 192.168.1.95:2022 -end - diff --git a/driver_fw/src/main.c b/driver_fw/src/main.c index d5b0e83..ba3ddb8 100644 --- a/driver_fw/src/main.c +++ b/driver_fw/src/main.c @@ -37,6 +37,8 @@ static bool idle_buf_ready = false; void update_tx_buf(void); +char usartbuf[256]; +int usartp = 0; int main(void) { /* Configure clocks for 64 MHz system clock. @@ -158,6 +160,8 @@ int main(void) { GPIOD->MODER = IN(0) | IN(1) | IN(2) | IN(3) | IN(4) | IN(5) | IN(6) | IN(8) | IN(9); + delay_us(5*1000*1000); + TIM1->CCMR1 = (6<CCMR2 = (6<CCER = TIM_CCER_CC2E | TIM_CCER_CC2NE | TIM_CCER_CC2NP | TIM_CCER_CC3E | TIM_CCER_CC3NE | TIM_CCER_CC3P; @@ -177,21 +181,44 @@ int main(void) { dma_tx_constant(COUNT_OF(waveform_zero_one), 0x00); xfr_8b10b_encode_reset(&encoder_state_8b10b); + USART1->CR1 = /* 8-bit -> M1, M0 clear */ + /* OVER8 clear. Use default 16x oversampling */ + /* CMIF clear */ + /* MME clear */ + /* WAKE clear */ + /* PCE, PS clear */ + /* RXNEIE, other interrupts clear */ + USART_CR1_TE + | USART_CR1_RE; + USART1->CR3 |= USART_CR3_DEM; /* Output DE signal on RTS pin */ + USART1->BRR = 6667; /* Set baudrate to 9600 Bd */ + USART1->CR1 |= USART_CR1_UE; /* And... go! */ + int i = 0; int j = 0; int k = 0; int n = 0; while (23) { + if (USART1->ISR & USART_ISR_RXNE_RXFNE) { + usartbuf[usartp] = USART1->RDR; + usartp ++; + if (usartp >= sizeof(usartbuf)) { + usartp = 0; + } + } + } + + { i++; j++; i %= 6; j %= 4; - delay_us(30000); + delay_us(100000); set_rj45_leds(1 << j); - set_status_leds(1 << i); + set_status_leds(0x01); if (i == 0) { k++; - if (k == 16) { + if (k == 10) { k = 0; n++; if (n == 16) { @@ -203,7 +230,7 @@ int main(void) { memset(tx_buf_write, 0, sizeof(*tx_buf_write)); for (size_t i=0; ipacket.channels); i++) { - tx_buf_write->packet.channels[i] = 0xff; + tx_buf_write->packet.channels[i] = (k < 9) ? (1<packet.brightness); i++) { tx_buf_write->packet.brightness[i] = 0xff; //(n<<4) | n; -- cgit