Skip to content

No serial RX on UART1 when using non-default pins #401

@PaulZC

Description

@PaulZC

Background:

I'm updating OpenLog Artemis to use v2.1.0 of the core. All is going well(ish) but I'm not able to receive any serial data on UART1. OpenLog Artemis uses pin 12 for Tx and pin 13 for Rx. Serial Tx on pin 12 works fine, I'm just not able to receive anything on pin 13.

Steps to replicate:

RedBoard Artemis ATP
v2.1.0 of the core
Use a jumper wire to link pin 12 to pin 13
Run this sketch:

// Apollo3 v2.1.0 UART Loopback Test
// Board: RedBoard Artemis ATP
// Use a jumper wire to connect Pin 12 (TX) to Pin 13 (RX)

UART mySerial(12, 13);

void setup() {
  Serial.begin(115200);

  mySerial.begin(115200);

  Serial.println("UART Loopback Test");

  mySerial.println("Hey, it worked!");

  delay(100);

  while (mySerial.available())
  {
    Serial.write(mySerial.read());
  }  
}

void loop() {
}

Open the serial monitor, and you should see this (captured using Serial1 on pins 24 and 25):

image

Instead, we get this:

image

Putting a logic analyzer on the jumper wire, I can see pin 12 transmitting:

image

So the issue is somewhere in the receive functionality.

I started digging into the core UART code, but I haven't found a smoking gun so far. It looks like pin 13 should be being configured correctly:

https://github.com/sparkfun/mbed-os-ambiq-apollo3/blob/be07f057170a4e9ed4a286abb2170b9df3d52de3/targets/TARGET_Ambiq_Micro/TARGET_Apollo3/device/PeripheralPins.c#L104

https://github.com/sparkfun/mbed-os-ambiq-apollo3/blob/be07f057170a4e9ed4a286abb2170b9df3d52de3/targets/TARGET_Ambiq_Micro/TARGET_Apollo3/device/PeripheralPinConfigs.c#L500-L509

https://github.com/sparkfun/mbed-os-ambiq-apollo3/blob/be07f057170a4e9ed4a286abb2170b9df3d52de3/targets/TARGET_Ambiq_Micro/TARGET_Apollo3/sdk/mcu/apollo3/hal/am_hal_pin.h#L165

I'm out of ideas... Any suggestions on where to dig next?

Cheers!
Paul

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions