Pins remaining for Serial Tranmission

Support forum for the Lambda Shield designed to connect Bosch LSU 4.9 wideband oxygen sensors to Arduino projects.
Post Reply
arch
Posts: 2
Joined: 03 Jun 2023 17:05

Pins remaining for Serial Tranmission

Post by arch » 03 Jun 2023 17:16

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?
Last edited by Christian_Bylund on 04 Jun 2023 16:27, edited 1 time in total.
Reason: Added code brackets.

User avatar
Christian_Bylund
Posts: 255
Joined: 07 Mar 2015 18:09

Re: Pins remaining for Serial Tranmission

Post by Christian_Bylund » 04 Jun 2023 16:38

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.
Best Regards,
Christian Bylund
Bylund Automotive AB

arch
Posts: 2
Joined: 03 Jun 2023 17:05

Re: Pins remaining for Serial Tranmission

Post by arch » 05 Jun 2023 09:09

Thanks for the help. It's working correctly

User avatar
Christian_Bylund
Posts: 255
Joined: 07 Mar 2015 18:09

Re: Pins remaining for Serial Tranmission

Post by Christian_Bylund » 05 Jun 2023 11:29

arch wrote:
05 Jun 2023 09:09
Thanks for the help. It's working correctly
Great, glad to help!
Best Regards,
Christian Bylund
Bylund Automotive AB

Post Reply