B u i l d i n g R e a l - T i me E mb e d d e d - - PowerPoint PPT Presentation

b u i l d i n g r e a l t i me e mb e d d e d a p p l i c
SMART_READER_LITE
LIVE PREVIEW

B u i l d i n g R e a l - T i me E mb e d d e d - - PowerPoint PPT Presentation

B u i l d i n g R e a l - T i me E mb e d d e d A p p l i c a t i o n s o n Q d u i n o MC A We b - c o n n e c t e d 3 D P r i n t e r C a s e S t u d y Zhuoqun (Tom) Cheng,


slide-1
SLIDE 1

Zhuoqun (Tom) Cheng, Richard West and Ying Ye

B u i l d i n g R e a l

  • T

i me E mb e d d e d A p p l i c a t i

  • n

s

  • n

Q d u i n

  • MC

A We b

  • c
  • n

n e c t e d 3 D P r i n t e r C a s e S t u d y

slide-2
SLIDE 2

3D Printing HOW-TO

CAD Model

X Y

Slicing Program G-code

Serial

Printed Object Firmware Serial

2

Melt the fjlament Move in 3D space Deposit onto the table

Extruder Table

Serial

slide-3
SLIDE 3

Web-connected 3D Printer

3

slide-4
SLIDE 4

Web-connected 3D Printer Print

Remote Job Submission

4

Local Slicing Correctness Verifjcatjon

slide-5
SLIDE 5

Microprocessor Atmel AVR, 8 bit, 20 MHz SRAM 8 KB I/O UART, SPI, I2C, PWM, GPIO

Printrbot Simple Metal

Web Server

Motor

Controller

5

Extruder Motor Motor

slide-6
SLIDE 6

RAMPS shield: I/O extension board

Custom Controller

64 bit dual-core Atom E3825 1.33 GHz 2 GB memory 86 GPIOs, I2C, SPI, UART, PWM Intel MinnowBoard MAX

7

slide-7
SLIDE 7

Custom Controller

8

RAMPS shield Companion Analog Circuits MinnowMAX

slide-8
SLIDE 8

Marlin Firmware

Main loop Read G-code

G-code

Translate to motor rotatjon

Timer1 Interrupt

Interpret Motor Data Stepper Motor Data

Timer2 Interrupt

Adjust fan & heater

Temperature

Temperature Control PID Temperature PID output

Variable Period 8ms Period

9

Motor Extruder

slide-9
SLIDE 9

10

Is this bad? Why?

Marlin on Linux Original Marlin Linux Port Main loop + interrupts handlers Multjple threads Timer interrupts Periodic nanosleep AVR I/O instructjons Intel MRAA IoT library All computatjons in the main loop Betuer code structure lightupd daemon + custom spooler

Jituer of the extruder, when submittjng relatjvely large fjles MinnowMAX Linux Marlin lightupd

Spooler

Spooler

slide-10
SLIDE 10

13

The Timing Problem H L d γ T T T

slide-11
SLIDE 11

struct timespec period = {.tv_sec = 0, .tv_nsec = 100000}; while (1) { nanosleep(&period, NULL); /* sleep for 100 us */ mraa_gpio_write(GPIO6, HIGH); /* write 1 to gpio6 */ mraa_gpio_write(GPIO6, LOW); /* write 0 to gpio6 */ }

10 kHz Pulse Train Frequency Period Theoretjcal 10 kHz 100000 ns Measured 7.91 kHz 100000 ns + 26422 ns Original PrintrBoard 9.96 kHz 100000 ns + 401 ns

14

Unstable

slide-12
SLIDE 12

10 kHz Pulse Train sysfs framework gpiolib framework GPIO Driver 15.7% 3.9% 40.1%

15

Scheduler hrtjmer framework Kernel Crossing 2.2% 9.2% 29.3% Lack of API with low and predictable overheads

struct timespec period = {.tv_sec = 0, .tv_nsec = 100000}; while (1) { nanosleep(&period, NULL); /* sleep for 100 us */ mraa_gpio_write(GPIO6, HIGH); /* write 1 to gpio6 */ mraa_gpio_write(GPIO6, LOW); /* write 0 to gpio6 */ }

slide-13
SLIDE 13

struct timespec period = {.tv_sec = 0, .tv_nsec = 100000}; while (1) { nanosleep(&period, NULL); /* sleep for 100 us */ mraa_gpio_write(GPIO6, HIGH); /* write 1 to gpio6 */ mraa_gpio_write(GPIO6, LOW); /* write 0 to gpio6 */ }

10 kHz Pulse Train Real-tjme environment setup PREEMPT_RT patch Settjng scheduling priority Locking pages into memory Further optjmizatjon Shield a core from the scheduler: isolcpu, cset… Disable tjmer interrupt on a core: CONFIG_NO_HZ_FULL ….

16

Lack of a simple and uniform programming interface

slide-14
SLIDE 14

QduinoMC Goals Design Easy to use Easy to port existjng Arduino program Take advantage of the multj-core Multjthread loops Pinning loops to cores Interrupt routjng Allow QoS specifjcatjon Loop budget and period Low I/O access overhead User-level I/O access

17

Simple APIs based on Arduino

loop (loopID, budget, period, [coreID]) noInterrupts (device, coreID) noTimer (coreID) interruptsVcpu (device, budget, period, [coreID]) digitalWrite () / digitalRead ()

slide-15
SLIDE 15

Marlin on QduinoMC

18

loop (1, 10, 100, 1), loop (2, 30, 100, 0), loop (3, 1, 80, 0) noTimer (1), noInterrupts (ALL, 1)

interruptsVCPU (I2C, 10ms, 100ms), interruptsVCPU (NIC, 10ms, 100ms)

Web server / Spooler -- default

slide-16
SLIDE 16

void setup ( ) { pinMode(GPIO6, OUTPUT); noInterrupts(ALL, 1); noTimer(1); } void loop (1, 100, 100, 1) { delayBusyNanoseconds(100000); digitalWrite(GPIO6, 1); digitalWrite(GPIO6, 0); }

10 kHz Pulse Train Again Frequency Period Theoretjcal 10 kHz 100000 ns Measured QduinoMC 9.569 kHz 100000 ns + 4504 ns Measured Linux 7.91 kHz 100000 ns + 26422 ns Original PrintrBoard 9.96 kHz 100000 ns + 401 ns Stable

19

slide-17
SLIDE 17

Test Object

20

Higher quality Faster printjng 10% code size reductjon Intuitjve and clear code structure

slide-18
SLIDE 18

Conclusion & Future Work

21

Designed and built a platgorm to ease the development of IoT applicatjons with critjcal tjming requirements Built a web-connected 3D printer as a case study analyzed 3D printers’ real-tjme propertjes Future work will extend web connectjvity to support local slicing and print verifjcatjon

slide-19
SLIDE 19

Q&A

Thank you! Questions? 22