Page 1 of 1

Pins remaining for Serial Tranmission

Posted: 03 Jun 2023 17:16
by arch
I am trying to transmit data from the uno with the lambda 2 shield to a teensy 4.1.
Without the shield I can transmit data from the uno to the teensy using the <SoftwareSerial.h> library, pins 11 and 12 are used for RX TX on the uno.
When using the shield and adding the required lines for Software Serial to the example code of the lambda 2 shield, I get the following error:

CJ125 = 0xFFFFE8FF

to counter this error i use the following lines of code where required :

Code: Select all

#define           CJ125_PROBLEM_WITH_SERIAL           0xFFFFE8FF        

if(CJ125_Status == CJ125_PROBLEM_WITH_SERIAL)
     CJ125_Status = CJ125_DIAG_REG_STATUS_OK;
This quick fix lets the sensor heat up and read lambda and oxygen correctly. However the Software Serial is not working from pins 11 and 12.

The code for Software Serial is :

Code: Select all

#include <SoftwareSerial.h>
SoftwareSerial mySerial(11, 12);

void setup() {
  
  //Set up serial communication.
  mySerial.begin(57600);

}

void loop(){

   mySerial.write(LAMBDA_VALUE);

}
Any ideas on why the Software Serial communication isn't working?

It starts working once I remove all the code for SPI communication with the CJ125 chip. This is a temporary solution as I would like to get diagnostics data. Any ideas on how to make Software Serial work and the SPI communication with the CJ125 together?

Re: Pins remaining for Serial Tranmission

Posted: 04 Jun 2023 16:38
by Christian_Bylund
Hello Arch,

Pins D11 and D12 are reserved for SPI communication on any Arduino (MISO and MOSI). SPI is required for the Lambda Shield 2.

You can use the standard Serial hardware interface RX (D0) and TX (D1) pins for serial communication on the Arduino Uno / Mega versions. On Arduino Mega you have 3 hardware serial interfaces Serial1, Serial2 and Serial3.

If you want to use software serial or anything else, D2, D3, D4, D8 and D9 digital pins are free.

Hope it helps.

Re: Pins remaining for Serial Tranmission

Posted: 05 Jun 2023 09:09
by arch
Thanks for the help. It's working correctly

Re: Pins remaining for Serial Tranmission

Posted: 05 Jun 2023 11:29
by Christian_Bylund
arch wrote:
05 Jun 2023 09:09
Thanks for the help. It's working correctly
Great, glad to help!