Jump to content
  • 0

Arduino serial on WF32


kdrewlo

Question

Please can someone tell me how to user the serial port(s) on the WF32 wile compiling and debugging with Arduino 1.8.7 (Windows Store)?  I can not get any serial(1.2.3).print statements to work I have even tried external serial to USB adapters attached to different pins.  What am I missing?

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

Hi @kdrewlo,

In the reference manual here in section 10.1 UART Ports discusses using uart 1 and uart 4. I would suggest looking at 12.1 Pinout Table by Pin Number starting on page 14 to find u1rx, u1tx, u2rx u2tx, u3tx, u3rx , u4tx and u4rx . Are you using the Digilent Core here.  Could you attach a picture of your uart wiring setup. I attached a screen shot of a multiple uart example. Could you attach your code.

thank you,

Jon

arduino_serial.jpg

Link to comment
Share on other sites

OK something is working here 

I get the Hello, world? on the Arduino Serial Monitor.  Does this mean I am using a soft UART?  Why doesn't hardware Serial1 work?

Ken

 

/*
  Software serial multple serial test (For chipKIT)

 Receives from the hardware serial, sends to software serial.
 Receives from software serial, sends to hardware serial.

 The circuit:
 * RX is digital pin 10 (connect to TX of other device)
 * TX is digital pin 11 (connect to RX of other device)

 created back in the mists of time
 modified 25 May 2012
 by Tom Igoe
 based on Mikal Hart's example
 Modified on Aug 31,2015 by Brian Schmalz for chipKIT
 
 This example code is in the public domain.

 */
#include <SoftwareSerial.h>

SoftwareSerial mySerial(0, 1); // RX, TX 10, 11 == 0, 1 ==

void setup()
{

  pinMode(LED_BUILTIN, OUTPUT);

  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);  
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);  
  
  // Open serial communications and wait for port to open:
  Serial1.begin(57600);
  while (!Serial1) {
    ;
  }

  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);  
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);  
  
  Serial1.println("Goodnight moon!");

  // set the data rate for the SoftwareSerial port
  mySerial.begin(115200);
  mySerial.println("Hello, world?");
}

void loop() // run over and over
{
  if (mySerial.available())
    Serial1.write(mySerial.read());
  if (Serial.available())
    mySerial.write(Serial.read());
}
 

Link to comment
Share on other sites

Hello @kdrewlo,

The serial example that @jpeyron showed uses the hardware serial library, but it is macroed in some of the Arduino/Digilent core libraries so you do not see it. Additionally, the sketch you have shown was created for a different board than the WF32 (and I think created before the WF32 existed), so pin 10 and pin 11 are not the correct pins for Serial1. As per the Board_Defs.h file for the WF32 (available in ..\AppData\Local\Arduino1\packages\Digilent\hardware\pic32\1.0.4\variants\WF32 for the Arudino download; I don't know where the Windows store app is installed), Serial 1 is based pins 39 and 40 (as well as the Reference manual that @jpeyron linked to), so they will not appear in the Serial Monitor which is only connected to Serial 0 which is on pins 0 and 1 by default.

Thanks,
JColvin

Link to comment
Share on other sites

Jon

In this and all these charts I see the logical pin number (Pin #), the processor pin number,  Signal name, Function.  I do net see the Jxx number of the board in this chart or any of the charts.  I had to trace the schematics back.

Ken

Link to comment
Share on other sites

Hi @kdrewlo,

The "Pin #" column in each of the charts is the number labeled on the silkscreen of the WF32. I don't believe the Jx-xx numbers are listed (despite the reference manual saying they are). I will see if this can be updated so that all of the material is consistent.

Let me know if this helps.

Thanks,
JColvin

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...