qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: "Stefan Hajnoczi" <stefanha@gmail.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Joaquin de Andres" <me@xcancerberox.com.ar>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Michael Rolnik" <mrolnik@gmail.com>,
	"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
	"Pavel Dovgalyuk" <dovgaluk@ispras.ru>,
	"Markus Armbruster" <armbru@redhat.com>
Subject: Re: [GSoC/Outreachy] Arduino complete setup visualization and emulation
Date: Fri, 21 Feb 2020 12:14:18 +0100	[thread overview]
Message-ID: <675f0951-7f47-ada3-e30d-4f8b2416253c@redhat.com> (raw)
In-Reply-To: <20200221105620.GD1484511@stefanha-x1.localdomain>

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	other threads:[~2020-02-21 11:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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é [this message]
2020-02-21 18:18       ` Joaquin de Andres
2020-02-24 11:25       ` Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=675f0951-7f47-ada3-e30d-4f8b2416253c@redhat.com \
    --to=philmd@redhat.com \
    --cc=armbru@redhat.com \
    --cc=dovgaluk@ispras.ru \
    --cc=f4bug@amsat.org \
    --cc=marcandre.lureau@redhat.com \
    --cc=me@xcancerberox.com.ar \
    --cc=mrolnik@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).