Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serial output is blocked by M_UDREx not resetting #11

Closed
vintagepc opened this issue Apr 7, 2020 · 5 comments · Fixed by #55
Closed

Serial output is blocked by M_UDREx not resetting #11

vintagepc opened this issue Apr 7, 2020 · 5 comments · Fixed by #55
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@vintagepc
Copy link
Owner

vintagepc commented Apr 7, 2020

Stock firmware does not boot, it waitspins in MarlinSerial::Write() because it appears M_UDREx is not getting reset. I'm not sure whether this is a quirk of Marlin serial or the emulator since the bootloader can talk over PTY and flash firmware.

@vintagepc vintagepc added the bug Something isn't working label Apr 7, 2020
@vintagepc vintagepc changed the title PROGMEM does not work with serial output Serial output is blocked by M_UDREx not resetting Apr 7, 2020
@vintagepc
Copy link
Owner Author

I wonder if something is up with the handoff from the bootloader. I did some experimenting and if I force to write to the second serial port I can get output and no bootloop.

echo: 3.9.0-RC1-3272. echo: Last Updated: Apr 8 2020 19:15:59 | Author: (none, default config).. Compiled: Apr 8 2020.. echo: Free Memory: 1652 PlannerBufferBytes: 1792.. echo:Hardcoded Default Settings Loaded.. adc_init. W25X20CL not responding.. CrashDetect ENABLED!. echo:enqueing "M83".. echo:enqueing "G1 E-1.000 F2700".. echo:enqueing "G1 Z10.000 F800.000".. FSensor ENABLED (sensor board revision: 03 or older). echo:SD init fail.. Wizard state: 0. Error:Temperature heated bed switched off. MAXTEMP triggered !..

@vintagepc vintagepc added the help wanted Extra attention is needed label Apr 10, 2020
@leptun
Copy link
Collaborator

leptun commented Apr 11, 2020

@vintagepc Did you push the required changes for the emulated serial port (primary)?

@vintagepc
Copy link
Owner Author

I pushed up an updated source but not an updated firmware as my local build has some other crap in it for debugging.

(114 in MarlinSerial.h)

		if (selectedSerialPort == 0)
		{
			while (!((UCSR1A) & (1 << UDRE1)));
			UDR1 = c;
		}

You should be able to just rebuilt it now with make MK3S.afx as I added a build rule and lifted a script from the main firmware repo

@vintagepc
Copy link
Owner Author

Note -the changes make it write to the first serial port.

By default it outputs to the console you run the program in. To make it a real "port" you can talk to with pronterface, uncomment the uart_pty_connect(&hw.UART1,'1'); line in setupSerial()
and watch the console output for a /tmp/.... device node you can connect to.

@vintagepc
Copy link
Owner Author

I made some progress on this. MarlinSerial::Begin clobbers the value of UDRE0. Presumably, on the hardware, this is reset to true automatically, but in simAVR it is left in this state.

As a result, it will spinlock waiting for it to be true in the first MarlinSerial::write() call.

vintagepc added a commit that referenced this issue Apr 16, 2020
vintagepc added a commit that referenced this issue Apr 16, 2020
vintagepc added a commit that referenced this issue Jul 25, 2020
vintagepc added a commit that referenced this issue Jul 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants