Serial.println() was not printing on serial monitor

Hello All,

I am trying decode irremote using STM32F103C8T6. the code as below.
the question is why Serial.println () :

Serial.println("setup()");
** Serial.println("TESTING OF IRREMOTE");**
** Serial.println("STM32F103C8T6 ARM 32 bit");**

it was not print on serial monitor.

Result of decoding ir remote code below the code.

#include <IRremote.h>
int IRpin = PA1;
String kodeKu;
  
struct kode
{
  uint32_t kodeValue;
  const char * ku;
} KodeList[] =
{
  {0xBA45FF00, "power"},
  {0xB946FF00, "mode"},
  {0xB847FF00, "silence"},
  {0xBB44FF00, "play"},
  {0xBF40FF00, "rewind"},
  {0xBC43FF00, "forward"},
  {0xF807FF00, "EQ"},
  {0xEA15FF00, "vol-"},
  {0xF609FF00, "vol+"},
  {0xE916FF00, "zero"},
  {0xE619FF00, "RPT"},
  {0xF20DFF00, "U/SD"},
  {0xF30CFF00, "one"},
  {0xE718FF00, "two"},
  {0xA15EFF00, "three"},
  {0xF708FF00, "four"},
  {0xE31CFF00, "five"},
  {0xA55AFF00, "six"},
  {0xBD42FF00, "seven"},
  {0xAD52FF00, "eight"},
  {0xB54AFF00, "nine"},
};

const char * GetKodeKu(uint32_t kode)
{
  size_t kuCount = sizeof KodeList / sizeof KodeList[0];
  for (size_t i = 0; i < kuCount; i++)
  {
    if (KodeList[i].kodeValue == kode)
    {
      Serial.print("Recognized as ");
      Serial.println(KodeList[i].ku);

      return KodeList[i].ku;
    }
  }
  Serial.println("Kode Not Recognized");
  return "";
}



void setup()
{
  // put your setup code here, to run once:
  Serial.begin(115200);
  delay(200);
  **Serial.println("setup()");**
**  Serial.println("TESTING OF IRREMOTE");**
**  Serial.println("STM32F103C8T6 ARM 32 bit");**
  IrReceiver.begin(IRpin);
  IrReceiver.enableIRIn();
}

void loop()
{
  Serial.println("loop()");

  // put your main code here, to run repeatedly:
  while (IrReceiver.decode() == 0);
  unsigned long value = (IrReceiver.decodedIRData.decodedRawData);
  Serial.print("Received: ");
  Serial.println(value, HEX);
  IrReceiver.resume();

  kodeKu = GetKodeKu(value);

  }

the result of decoding on serial monitor normal as per the button press.

Received: BA45FF00
Recognized as power
loop()
Received: B946FF00
Recognized as mode
loop()
Received: B847FF00
Recognized as silence
loop()
Received: BB44FF00
Recognized as play
loop()
Received: BF40FF00
Recognized as rewind
loop()
Received: BC43FF00
Recognized as forward
loop()
Received: F807FF00
Recognized as EQ
loop()
Received: EA15FF00
Recognized as vol-
loop()
Received: F609FF00
Recognized as vol+
loop()
Received: E916FF00
Recognized as zero
loop()
Received: E619FF00
Recognized as RPT
loop()
Received: F20DFF00
Recognized as U/SD
loop()
Received: F30CFF00
Recognized as one
loop()
Received: E718FF00
Recognized as two
loop()
Received: A15EFF00
Recognized as three
loop()
Received: F708FF00
Recognized as four
loop()
Received: E31CFF00
Recognized as five
loop()
Received: A55AFF00
Recognized as six
loop()
Received: BD42FF00
Recognized as seven
loop()
Received: AD52FF00
Recognized as eight
loop()
Received: B54AFF00
Recognized as nine
loop()

might do the trick

(Hint) What is the line speed for Serial?

Am I missing something obvious?

You begin() Serial1 but are printing to Serial?

115200

actually Serial.begin(115200);

i just forgot to delete it after several test before (return to default code). sorry

i tested again, still not printing on serial monitor

sorry i tested still not working. any others trick? thanks

What happens if you press the on-board reset switch?

already tested, nothing print on serial monitor. usually after press reset button Serial.println(......) printed on serial monitor. this one nothing, only after press remote button, printed as per buttons code.

Did you try what @Idahowalker suggested but with Serial (not Serial1)?

already tested, same result

Run a simple example see if that works ;

  • check monitor is running same board rate

Have a read here ?

same 115200 also, i try another baudrate also.

what was caused that no print out on serial monitor?

what should i do next to solve this issue. thank you

I believe that some versions of Arduino Core SW use the USB link as "Serial" (with the UART being Serial1), and others use Serial as the UART and something like SerialUSB for the USB virtual Serial port.
Make sure that the port you're trying to connect to is the port where the data is actually going. This may be complicated by some STM32 boards having a Separate USB/Serial adaptor chip that talks to the UART. (that makes booting easier, since the STM103 doesn't have a ROM bootloader for USB, but does have one for Serial.)

do you mean base on the fig above. i have tried :

  1. TX1 , RX1 pin PA9 and PA10; i set Serial.begin(115200), and tried also with Serial1.begin(115200).
  2. TX2, RX2 pin PA2 and PA3; I set Serial2.begin(115200), also tried whithout "2".
  3. TX3 and rx3 pin PB10 and PB11; I set Serial3.begin(115200), also tried without "3".

bootloader using SERIAL BOOTLOADER. still same problem.

  Serial.begin(115200);
  while (!Serial);
  delay(200);
  Serial.println("setup");
  Serial.println("TEST SERIAL MONITOR");
  Serial.flush();
  IrReceiver.begin(IRpin);
  IrReceiver.enableIRIn();

still blank

while (!Serial) does not work on all boards, try a short delay after Serial.begin() and see if that helps.
< edit >
I see you already tried that. Maybe try a longer delay.
Looking at the original post, I see you are actually getting output later in the code, so it obviously is not crashing, so my comment on Serial.flush is incorrect (I had deleted the post before your reply).

  Serial.begin(115200);
  delay(50);
  Serial.println("setup");
  Serial.println("TEST SERIAL MONITOR");
  Serial.flush();
  IrReceiver.begin(IRpin);
  IrReceiver.enableIRIn();

still blank