(theoretically) got encoders working
Everything up to sending all 8 encoder values should work now (including
the packet format + header information, bootloader (fixed some bugs in
the UART code for that), etc).
diff --git a/bbb_cape/src/cape/uart_common.c b/bbb_cape/src/cape/uart_common.c
index 77c796f..783c154 100644
--- a/bbb_cape/src/cape/uart_common.c
+++ b/bbb_cape/src/cape/uart_common.c
@@ -1,10 +1,17 @@
#include "cape/uart_common.h"
#include "cape/uart_common_private.h"
+#include "cape/util.h"
+
#define FPCLK 60000000
+// The UART is on PA9 and PA10.
void uart_common_configure(int baud) {
+ gpio_setup_alt(GPIOA, 9, 7);
+ gpio_setup_alt(GPIOA, 10, 7);
+ GPIOA->OSPEEDR |= GPIO_OSPEEDER_OSPEEDR9; // we want to go FAST!
RCC->APB2ENR |= RCC_APB2ENR_USART1EN;
+
// baud = 60MHz / (8 * (2 - OVER8) * (mantissa / fraction))
int fraction = 8; // the biggest it can be with OVER8=0
int mantissa = FPCLK * (16 /* 8 * (2 - OVER8) */ / fraction) / baud;