After one successful preview of compile, the upload returns error

rx_buffer not defined in this scope. 

How do I fix this?

  • $\begingroup$ Welcome to 3dPrinting.SE! $\endgroup$ Apr 19 '19 at 2:03
  • 1
    $\begingroup$ Have you changed #define SERIAL_PORT 0 in MarlinSerial.h? $\endgroup$
    – 0scar
    Apr 19 '19 at 14:22
  • $\begingroup$ Have you found and fixed the problem? If so, has the answer below led you to the solution? Please vote to accept the answer so this question is not bumped up once in a while and can be removed from the unanswered question list. You may even add your own solution and accept that after 48 hours! If you have not been able to address the problem please update your question. $\endgroup$
    – Greenonline
    May 7 '19 at 5:21

The line defining SERIAL_PORT in MarlinSerial.h should read:

#define SERIAL_PORT 0

To [mis-]quote this answer from RepRap:'rx_buffer' was not declared in this scope (the emphasis is mine):

#define SERIAL_PORT 4

This is the serial port on the controller, not the serial port on your computer. 0 through 3 are valid options on a controller with a atmel 2560.

Unless you are doing something like serial over bluetooth or deliberately not using the USB port you should not change this from 0

The same error is reported on the Arduino forums, 'rx_buffer' was not declared in this scope:

Have redone over 5 times and always getting " 'rx_buffer' was not declared in this scope ".

Now I tried Factory marlin and same " 'rx_buffer' was not declared in this scope " . Dont know what to do - I'm so lost.


#define SERIAL_PORT 4     //before was 0

Nothing else


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.