Skip to content

Instantly share code, notes, and snippets.

@metaquanta
Last active August 19, 2023 18:28
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save metaquanta/6103fb77116d931e9e4b527088f49ad9 to your computer and use it in GitHub Desktop.
Save metaquanta/6103fb77116d931e9e4b527088f49ad9 to your computer and use it in GitHub Desktop.
MP Select Mini USART Interface

MP Select Mini

The serial cable (that ordinarily connects to the LCD controller) has four wires: Red, White, Green, Black.

  • Red ➙ Ground
  • White ➙ TX USART1 - pin 42
  • Green ➙ RX USART1 - pin 43
  • Black ➙ +3.3V (yup, they're backwards)

†: on the STM32 processor

(see notes)

Raspi (With PL011 exposed)

  • Pin 6 (or 9, 14, ...) ➙ Ground
  • pin 8 ➙ TX (GPIO14)
  • pin 10 ➙ RX (GPIO15)
  • pin 1 ➙ +3.3V†

†: You don't actually connect the 3.3v.

MPS mini ⟷ Raspi over serial

  • pin 6 ⟷ Red Orange
  • pin 8 ⟷ Green Green
  • pin 10 ⟷ White Yellow

‡: the colors of the jumper wires on the cable I made.

pins 6,8,and 10 are a nice block on the outside row, skip two down.

Results (WiP)

I've successfully connected with:

  • minicom
  • octoprint
  • pronterface(s)

All at 500k baud and with the 3.3V line left dettached.

I only had success after having the Pi and the Mini share ground off the same power supply.

The connection succeeds near-instantly every time and seems, so far, much more stable. I've hacked pronterface to ignore the non-gcode and completed prints without a glitch.

serial_init    
SetSysTick     
RetrieveSettings
port_init      
LED_ON         
ENDSTOP P TRIGGERED
ENDSTOP P TRIGGERED
setup          
���Ӻ�����������Һ����Һ���

The garbage on the last line is fbd3d9d3bad3d4c1d2d4c5c4fdfbd6c5d2bab4b0fdfbd2bad5c4fd in hex.

Doesn't look very random. They're all really high. Flip the first bit of each byte and you get ASCII back. Following setup is {SYS:STARTED}{VER:40}{R:UD} which looks like the codes mentioned here and reported there.

I also see FBD3D9D3BAC2D5C9CCC4FD which is SYS:BUILD} a bunch. I don't know what happened to the leading '{'.

Pi Zero W w/ Octopi

ttyS0 - 16550 (mini-UART)

setserial -a

$ sudo setserial -a /dev/ttyS0
/dev/ttyS0, Line 0, UART: 16550, Port: 0x0000, IRQ: 214
        Baud_base: 31250000, close_delay: 50, divisor: 0
        closing_wait: 3000
        Flags: spd_normal skip_test

Idle

$ sudo stty -F /dev/ttyS0
speed 9600 baud; line = 0;
-brkint -imaxbel

Running a getty:

$ sudo stty -F /dev/ttyS0 
speed 115200 baud; line = 0;
min = 1; time = 0;
-brkint -icrnl -imaxbel iutf8
-isig -icanon -iexten -echo -echoe -echok -echoctl -echoke

ttyACM0 - MP USB

setserial -a

$ sudo setserial -a /dev/ttyACM0 
/dev/ttyACM0, Line 0, UART: unknown, Port: 0x0000, IRQ: 0
        Baud_base: 9600, close_delay: 5, divisor: 0
        closing_wait: 300
        Flags: spd_normal low_latency

Unlike the others, Baud_base is 9600 initially but changes based on connection attempts.

Idle

$ sudo stty -F /dev/ttyACM0 
speed 9600 baud; line = 0;
-brkint -imaxbel

After a failed auto-baud detect run

$ sudo stty -F /dev/ttyACM0 
speed 9600 baud; line = 0;
min = 0; time = 0;
-brkint -icrnl -imaxbel
-opost
-isig -icanon -iexten -echo -echoe -echok -echoctl -echoke

Successfully connected

$ sudo stty -F /dev/ttyACM0
speed 115200 baud; line = 0;
min = 0; time = 0;
-brkint -icrnl -imaxbel
-opost
-isig -icanon -iexten -echo -echoe -echok -echoctl -echoke

ttyAMA0 - PL011

setserial -a

$ sudo setserial -a /dev/ttyAMA0 
/dev/ttyAMA0, Line 0, UART: undefined, Port: 0x0000, IRQ: 81
        Baud_base: 3000000, close_delay: 50, divisor: 0
        closing_wait: 3000
        Flags: spd_normal

There are three red flags (herrings?) that will probably come up:

  • UART: undefined as reported by set serial above.
  • After loading the AMBA PL011 UART driver, the console will print uart-pl011 20201000.serial: could not find pctldev for node /soc/gpio@7e200000/uart0_pins, deferring probe
  • When accessed, the console will print uart-pl011 20201000.serial: no DMA platform data These all seem to be expected on a Pi and won't block connecting.

Idle

$ sudo stty -F /dev/ttyAMA0 
speed 9600 baud; line = 0;
-brkint -imaxbel

Controlled by BT system

$ sudo stty -F ttyAMA0
speed 3000000 baud; line = 15;
min = 1; time = 0;
-brkint -icrnl -imaxbel
-opost
-isig -icanon -iexten -echo 

Connected to MP Select Mini

$ sudo stty -F /dev/ttyAMA0 
speed 500000 baud; line = 0;
min = 0; time = 0;
-brkint -icrnl -imaxbel
-opost -onlcr
-isig -icanon -iexten -echo -echoe -echok -echoctl -echoke
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment