qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [GSoC/Outreachy] Arduino complete setup visualization and emulation
@ 2020-02-10 19:58 Philippe Mathieu-Daudé
  2020-02-11 10:51 ` Stefan Hajnoczi
  0 siblings, 1 reply; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-02-10 19:58 UTC (permalink / raw)
  To: qemu-devel@nongnu.org Developers, Joaquin de Andres
  Cc: Marc-André Lureau, Pavel Dovgalyuk, Markus Armbruster,
	Stefan Hajnoczi, Michael Rolnik

[*] Goal:

Be able to use a visual virtual arduino board, and program it with
the Arduino IDE. The result should be easily usable by newcomers to
the Arduino world.

[*] Prerequisite:

- AVR port and Arduino machines merged upstream
- AVR flash device working (for firmware upload via IDE)

This works applies to a specific circuit configuration represented as
a netlist.

[*] Deliverables

- IDE Integration
  Configure QEMU with the Arduino IDE (using chardev UART0).
  Compile program and upload via serial.

- UI: Python:
  Connect UART1 (via QMP or chardev), display as textbox
  (input is not important at this point).

- QEMU: GPIO
  Produce script to extract GPIO devices used from the netlist.
  Configure QEMU devices to use the previous names/values.
  Publish GPIO events (name, tension as float) via a QMP socket
  (JSON form?).
  Write test which runs FreeRTOS test to generates a stable output.

- UI interface (Python)
  Connect to the QMP socket and display the GPIO events.
  Now GPIOs are connected to LEDs. Represent graphical LEDS as ON/OFF.
  Add an oscilloscope representation (matplotlib widget). Each GPIO
  can be plugged into the oscilloscope channels.
  Add Switch and PushButton to the UI, generating QMP events which
  trigger GPIO input.
  Add push button for arduino reset (already on board) signaling the
  core, and switch for general power (for QEMU shutdown and start).

- Test with the arduino examples
  Basic: "Blink: Turn an LED on and off."

- QEMU: PWM
  Modify script to extract PWM devices used from the netlist.
  Configure QEMU devices to use the previous names/values.
  Use QEMU sound API to generate a stream of PWM values (as a wav).
  Add a QMP command to lookup the PWM wav stream.
  Write a FreeRTOS test producing a sinusoidal via PWM, verify the
  wav form.

- UI interface (Python)
  Lookup wav stream via QMP socket, connect to it, display to
  oscilloscope view.
  Add graphical representation of the LED intensity to the LED.

- Test with the arduino examples
  Analog: "Fading: Use an analog output (PWM pin) to fade an LED."

- QEMU: ADC
  Modify script to extract ADC devices used from the netlist.
  Similarly to the PWM, use sound wav stream to read ADC samples.

- UI: Python
  Add a textbox to set the ambient temperature (A thermometer is
  connected to some ADC pin).
  Use slider to set the tension sampled by the ADC (as a potentiometer)

- Test with the arduino examples
  Analog: "Analog Input: Use a potentiometer to control the blinking
  of an LED."

- QEMU: Other communication protocols
  Modify script to extract RTC (via I2C) and SD card (via SPI) from
  the netlist.

- Propose examples to Arduino IDE for these use cases.

- QEMU: Match physical electrical characteristics (extra)
  Use imprecise VOL/VOH output
  Check input within VIL/VIH range
  Mark input dead when out of range

- Extra (fun):
  Connect 2 QEMU Arduino interacting with each other

- UI: Python (extra++):
  Add Seven-Segment Display
  Add SSD1306 128×32 display controller or Nokia 5110 Graphic LCD
  Propose examples to Arduino IDE for these use cases.


Co-mentor: Philippe Mathieu-Daudé <f4bug@amsat.org>
Co-mentor: Joaquín De Andres <me@xcancerberox.com.ar>


Reference Schema:

           +-----+---------------------+
           |     |                     |
           |     |                     |
           |     |                     |
           |     |    Arduino IDE      |
           |     |                     |
           |     |                     |
           |     +---------------------+
           |     |                     |
           |     |                     |
           +-----+------------------+--+
                                    |
                                    |console
              +------------------+  |chardev
              |                  |  |
              |                  <--+
              |       QEMU       |
  PWM stream  |                  |
+-------------+     AVR core     |
|             |                  |
|         +---+                  <------+
|         |   |                  |      |JSON
|    JSON |   +------------------+      |event
|    event|                             | I/O
|     I/O |                             |
|         |                             |
|    +----v-----------------------------+---+
|    |        LED LED LED LED DIPSW         |
|    | +---+                          +---+ |
|    | |osc|    +-----------------+   |osc| |
|    | +---+    |                 |   +---+ |
|    | +---+    |                 |   +---+ |
|    | |osc|    |   Arduino board |   |osc| |
|    | +---+    |                 |   +---+ |
|    | +---+    |                 |   +---+ |
|    | |osc|    +-----------------+   |osc| |
+----> +---+                          +---+ |
     |       POT POT 7LED PWM PWM PWM       |
     +--------------------------------------+
     |                                      |
     |          Serial console              |
     +--------------------------------------+


D-Bus can be considered too:

      +-----+---------------------+
      |     |                     |
      |     |                     |
      |     |                     |
      |     |    Arduino IDE      |
      |     |                     |
      |     |                     |
      |     +---------------------+
      |     |                     |
      |     |                     |
      +-----+-------------+-------+
                          |
                          |
+-----------------+       |
|                 <-------+
|                 |
|      QEMU       +---------------+
|                 |               |
|    AVR core     |         +-----v------+
|                 +--------->            |
|                 |         |            |
|                 <---------+    DBUS    |
+-----------------+         |            |
                            |            |
                            +--+----^----+
                               |    |
+----v-------------------------v----+--+
|        LED LED LED LED DIPSW         |
| +---+                          +---+ |
| |osc|    +-----------------+   |osc| |
| +---+    |                 |   +---+ |
| +---+    |                 |   +---+ |
| |osc|    |   Arduino board |   |osc| |
| +---+    |                 |   +---+ |
| +---+    |                 |   +---+ |
| |osc|    +-----------------+   |osc| |
> +---+                          +---+ |
|       POT POT 7LED PWM PWM PWM       |
+--------------------------------------+
|                                      |
|          Serial console              |
+--------------------------------------+


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-02-24 11:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-10 19:58 [GSoC/Outreachy] Arduino complete setup visualization and emulation Philippe Mathieu-Daudé
2020-02-11 10:51 ` Stefan Hajnoczi
2020-02-21 10:56   ` Stefan Hajnoczi
2020-02-21 11:14     ` Philippe Mathieu-Daudé
2020-02-21 18:18       ` Joaquin de Andres
2020-02-24 11:25       ` Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).