qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [GSoC/Outreachy] Arduino complete setup visualization and emulation


From: Philippe Mathieu-Daudé
Subject: Re: [GSoC/Outreachy] Arduino complete setup visualization and emulation
Date: Fri, 21 Feb 2020 12:14:18 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

On 2/21/20 11:56 AM, Stefan Hajnoczi wrote:
On Tue, Feb 11, 2020 at 10:51:19AM +0000, Stefan Hajnoczi wrote:
On Mon, Feb 10, 2020 at 08:58:28PM +0100, Philippe Mathieu-Daudé wrote:

Ping?

QEMU has been accepted as a mentoring organization.  Please post a final
version of this project idea on the wiki:

   https://wiki.qemu.org/Google_Summer_of_Code_2020

I apologize, quickly after we chat on IRC about this last week I did the modifications but forgot to reply to this thread.

There is the project description with 1 FIXME and 2 TODO (add the references), we will update the wiki tomorrow:

---

[*] 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.

[*] Summary

The project will add a visual representation of an Arduino board.

By running the code on the emulated AVR processor, the virtual board is
updated and displays the changes. Interracting with the code via external
events (sensors) triggers changes on the UI.

[*] Materials provided

- a specific circuit configuration represented as a netlist.
- preset Arduino tests compliant with QEMU limitations
- QMP commands documentation

[*] Essential skills required

- Fluent in C
- Comfortable programming in Python
- Knowledge of Javascript might be useful (Java will *not* be used).
- Working knowledge with User Interfaces

* Electrical engineering background is not essential


[*] Deliverables

- IDE Integration
  Configure QEMU with the Arduino IDE (using chardev UART0).
  Compile program and upload via serial.
  The IDE doesn't need modifications.

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

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

- UI (Python)
  Connect to the QMP socket and display the GPIO events.
  Now GPIOs are connected to LEDs. Present graphical LEDs as ON/OFF.
  Add an oscilloscope representation (matplotlib widget). Each GPIO
  can be plugged into the oscilloscope channels.
  Add Switches and PushButtons to the UI, generating QMP events which
  trigger GPIO input.
  Add a push button to reset the Arduino (already on board) signaling to
the core, and[to] switch for[to] general power (for QEMU shutdown and start).
  ### FIXME check with Joaquin ###

- 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 (Python)
  Lookup the wav stream via the QMP socket, connect to it, display
  it on the oscilloscope view.
  Add a graphical representation of the LED intensity.

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

- UI: Python
  Add a textbox to set the ambient temperature (a thermometer is
  connected to some ADC pins).
  Use a slider to set the tension sampled by the ADC (like if it
  was a potentiometer).

[*] Test with the preset arduino examples (### TODO add references ###)

- Basic: "Blink: Turn a LED on and off."
- Analog: "Fading: Use an analog output (PWM pin) to dim a LED."
- Analog: "Analog Input: Use a potentiometer to control the flashing
  of a LED."

Additional tasks are available for applicants who completes the project.

[References]


[*] Prerequisites:

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


Co-mentor: Philippe Mathieu-Daudé <address@hidden>
Co-mentor: Joaquín De Andres <address@hidden>


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| |               |
|    | +---+    |                 |   +---+ |               | Virtual Board
|    | +---+    |                 |   +---+ |               |    (UI)
|    | |osc|    +-----------------+   |osc| |               |
+----> +---+                          +---+ |               |
     |       POT POT 7LED PWM PWM PWM       |               |
     +--------------------------------------+               |
     |                                      |               |
     |          Serial console              |               |
     +--------------------------------------+            ---/


[*] Additional tasks (saved on list)

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

- QEMU: Match physical electrical characteristics

  Model the VOL/VOH/VIL/VIH ranges, and consider to mark an input
  as dead if the provided value is out of range (smoke on the UI!)

- QEMU: Connect 2 virtual Arduinos and ensure they are communicating
  successfully with each other.

- UI (Python)

  Add graphical displays (Seven-Segment, SSD1306 128×32, Nokia 5110
  Graphic LCD).

- Propose additional tests (Use of RTC, SD card, LCD, ...).

---




reply via email to

[Prev in Thread] Current Thread [Next in Thread]