Merge pull request #2010 from cesanta/f429-debug-uart

Use UART_DEBUG
This commit is contained in:
Sergio R. Caprile 2023-02-01 19:53:53 -03:00 committed by GitHub
commit 15ad58b5cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 2 deletions

View File

@ -23,7 +23,8 @@ flash: firmware.bin
# Requires env variable VCON_API_KEY set
DEVICE_URL ?= https://dash.vcon.io/api/v3/devices/2
test: update
test: EXTRA_CFLAGS += -DUART_DEBUG=UART1
test: update
curl --fail -su :$(VCON_API_KEY) $(DEVICE_URL)/tx?t=5 | tee /tmp/output.txt
grep 'Ethernet: up' /tmp/output.txt
grep 'MQTT connected' /tmp/output.txt

View File

@ -44,7 +44,7 @@ int main(void) {
gpio_output(LED2); // Setup blue LED
gpio_input(BTN1); // Set button to input
irq_exti_attach(BTN1); // Attach BTN1 to exti
uart_init(UART1, 115200); // Initialise debug printf
uart_init(UART_DEBUG, 115200); // Initialise debug printf
MG_INFO(("Starting, CPU freq %g MHz", (double) SYS_FREQUENCY / 1000000));

View File

@ -157,6 +157,10 @@ struct uart {
#define UART2 ((struct uart *) 0x40004400)
#define UART3 ((struct uart *) 0x40004800)
#ifndef UART_DEBUG
#define UART_DEBUG UART3
#endif
static inline void uart_init(struct uart *uart, unsigned long baud) {
// https://www.st.com/resource/en/datasheet/stm32f429zi.pdf
uint8_t af = 7; // Alternate function