Skip to content

PIC18 UART Driver #43

Open
AndrewWang001 wants to merge 8 commits intomainfrom
uart-driver
Open

PIC18 UART Driver #43
AndrewWang001 wants to merge 8 commits intomainfrom
uart-driver

Conversation

@AndrewWang001
Copy link
Copy Markdown
Member

@AndrewWang001 AndrewWang001 commented May 23, 2025

Initial Integration Test

Added

  • pic18f26k83/uart.c
  • include/uart.h
    (from ltt 2024 code)

Testing

  1. Wiring
  1. Software
  • switched to ltt repo to test uart
  • used ltt's main as is, except
    • commented out all CAN/radio logic to remove console spam:
      // radio current checks
      // can_msg_t msg;
      // …
    • Inserted in loop:
      uint8_t test[] = "Hello World ";
      uart_transmit_buffer(test, sizeof(test) - 1);
  • Build and Flash
  1. Run
  • Open PuTTY on COM port for FTDI cable (idk mac)
  • 115200 baud rate
  • should see text Hello World Hello World Hello World … printing every 500ms

Screenshot 2025-05-23 015030
Screenshot 2025-05-23 015127
Screenshot 2025-05-23 015147

@AndrewWang001
Copy link
Copy Markdown
Member Author

AndrewWang001 commented Jun 2, 2025

Customization + Testing

UART driver tested on LTT hardware and verified working.

Steps taken:

  • Switched to LTT codebase (uart.h, uart.c, and main.c)

  • Replaced uart.h with the new version and inlined common.h to define w_status_t (since LTT didn’t include it)

  • Replaced uart.c with the new version and re-added PPS pin configuration (was previously removed for external usage)

  • Modified main.c to use the updated initialization call and uart sending:

    uart_init(115200, 48000000UL, true);

    const char *test = "Hello World V2.1 ";
    for (uint8_t i = 0; test[i] != '\0'; i++) {
       uart_transmit_byte(test[i]);
     }
    
  • Modified main.c by deleting all the code irrelevant for UART (view test branch linked below)

  • Flashed firmware and confirmed proper UART output in PuTTY at 115200 baud with flow control enabled

Correct output of "Hello World " repeating every 500ms — also noticed the weird garbage characters from early UART startup are now gone.

Tested with different baud rates as well (4800, 9600, 115200, etc)

🔗 Test branch (LTT repo):
https://github.com/waterloo-rocketry/cansw_telemetry_rfd/tree/UART_ltt_test

image

@AndrewWang001 AndrewWang001 marked this pull request as ready for review June 2, 2025 01:05
@AndrewWang001 AndrewWang001 changed the title add pic18 ltt uart driver PIC18 UART Driver Jun 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants