Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modified main.c to enable uart1 when UART1_CDC is set #45

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions Firmware/pico-ice-default/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

// pico-sdk
#include "pico/stdio.h"
#include "pico/stdio_usb.h"
#include "hardware/irq.h"
#include "hardware/gpio.h"
#include "hardware/uart.h"
Expand All @@ -33,8 +34,15 @@
#include "ice_fpga.h"
#include "ice_led.h"

#define UART_TX_PIN 0
#define UART_RX_PIN 1
// GP0 UART0Tx ICE27
// GP1 UART0Rx ICE25
#define UART0_TX_PIN 0
#define UART0_RX_PIN 1

// GP4 UART1Tx ICE26
// GP5 UART1Rx ICE23
#define UART1_TX_PIN 4
#define UART1_RX_PIN 5

#define DOC_FORWARD_SPI \
"https://pico-ice.tinyvision.ai/group__ice__usb.html#autotoc_md2"
Expand Down Expand Up @@ -113,13 +121,20 @@ static void repl_prompt(void)

int main(void)
{
// Enable USB-CDC #0 (serial console)
stdio_init_all();

#if ICE_USB_UART0_CDC
// Enable the physical UART
uart_init(uart0, 115200);
gpio_set_function(UART_TX_PIN, GPIO_FUNC_UART);
gpio_set_function(UART_RX_PIN, GPIO_FUNC_UART);
gpio_set_function(UART0_TX_PIN, GPIO_FUNC_UART);
gpio_set_function(UART0_RX_PIN, GPIO_FUNC_UART);
#endif

#if ICE_USB_UART1_CDC
// Enable the physical UART
uart_init(uart1, 115200);
gpio_set_function(UART1_TX_PIN, GPIO_FUNC_UART);
gpio_set_function(UART1_RX_PIN, GPIO_FUNC_UART);
#endif

// Let the FPGA start
ice_fpga_init(12);
Expand All @@ -128,6 +143,9 @@ int main(void)
// Configure USB as defined in tusb_config.h
ice_usb_init();

// Enable USB-CDC #0 (serial console)
stdio_usb_init();

// Prevent the LEDs from glowing slightly
ice_led_init();

Expand Down