Replies: 14 comments 14 replies
-
See this comment: it seems the maintainers have plans for a "hardware in the loop" test environment. Perhaps there is scope for collaboration? |
Beta Was this translation helpful? Give feedback.
-
I like the goal, but have a few questions on the approach.
In my personal experience I regularly need flash and run tools on some 8-15 devices, and similar for testing. If I understand your design this would cost me somewhere in the range of a couple of hundred dollar for my own kit, which I would find prohibitive, but might want to try out on a limited scale. I would definitely be interested to see if, and which, process I could run on your setup. |
Beta Was this translation helpful? Give feedback.
-
This is absolutely something we want! For the record, you probably know this, but is generally referred to as HIL (Hardware In the Loop) testing. I've started heading down this road; I have put aside a PC (i5 NUC), USB hub and enough microcontrollers to cover a large portion of ports. I've also started a similar design sketch for the 'tentacle' you mentioned, though I was thinking of basing it on an STMH5 or even H7 since the RP2040 has some limitations (though the PIO is compelling for some testing). My design was in two parts however; a base board and an adaptor. The base board would host the test micro (H5/H7) and would be consistent for all 'tentacles', it would also provide a couple of high-density sockets breaking out all the necessary GPIOs. The adaptor would plug into the sockets and provide an interface to match each of the devices under test. Just for everyone else's benefit, in the testing space, the micro being tested is known as the DUT (device under test) and the micro performing the testing is the ATE (automated test equipment). I've also started the skeleton of a MicroPython High-Level Test Suite which could provide some initial tests.. It's intended to execute on hardware and instantiate many of the standard MicroPython classes to ensure they conform to the appropriate interfaces. No ATE is required. It's a shallow set of tests but may be a good place to start given that it's relatively simple to implement. To address your questions directly:
Regressions between builds, particularly for releases, is a major issue that HIL testing can help solve. I use MicroPython commercially and updating between major releases can be challenging. Maybe not a 'daily' problem but still important! I'd also just generally like to help out the MicroPython project here; HIL tests in CI are highly desirable.
I have enough hardware to cover most ports. Most important to me: stm32, esp32, rp2. Then: mimxrt, samd, renesas, esp8266, nrf. I'd like to see sensors tested too but it's far less important than testing the micros, for me.
Probably start with the most simple (Pin, I2C, SPI) and build on it.
Owning/maintaining it myself. Or contributing to tests if someone else is sufficiently motivated to run a system. |
Beta Was this translation helpful? Give feedback.
-
Out of interest how does "hardware in loop" deal with interfaces such as SPI and I2C? I2C in particular has challenges like clock stretching and error conditions. |
Beta Was this translation helpful? Give feedback.
-
Maybe of slight interest: we attempted something similar for CircuitPython years ago. But it did not progress due to various logistical issues. Using an RPi as the host was a mistake: the flash cards were going bad too fast. https://github.com/adafruit/rosie-ci (after Rosie the Robot) |
Beta Was this translation helpful? Give feedback.
-
How would one go about testing incoming signals ? But for incoming signal processing there should be an option to test as well. This is still in experimentation phase , so I do not want to spend effort on maintaining test scripts that i need to change with every iteration Currently I control this using a Jupyter notebook with micropython-magic to control the two DUTs So I would suggest that an essential part of this setup would be to have something that can record and replay signals that can be used as a test input. A logic analyzer can record , but not replay. ( id be interested in a solution to that) |
Beta Was this translation helpful? Give feedback.
-
It's an important question, the reality is generally application specific. Ideally, the host micro could present itself as a SPI & I2C peripheral device, wired to the device under test (DUT,) then write some multitests to send data back and forth in various forms to test. The DUT boards can gradually be made more complicated over time, adding things like flash, sdcards, I2S, PWM, UART checks etc. Compatibility with particular peripheral devices isn't really the goal of using here, it's proofing that the MCU peripheral is still working just as well as it was on the previous commit - I think of HIL tests as more about catching regressions than testing during initial development. |
Beta Was this translation helpful? Give feedback.
-
The way I generally look at it, the first step to this kind of testing is to break it down as much as possible and test everything you can on PC / Unix port first. Then only go to HIL for things that can't be done that way. Eg. application specific signals like this can often be tested in two parts; the UART hardware needs to be tested to prove it's working to the Stream protocol, then separately the DMX protocol can be unit tested over any Stream, eg unix port socket. For code that's under active development, it's often good to use "test driven development", testing your DMX protocol on Unix port in small fast tests. Though obviously this Unix testing reaches its limit when the test needs to also involve the custom hardware receiving the DMX... then we're back to full HIL of the whole product. Long story short, HIL test hardware is always application specific, wiring up custom IO via labjack or a host micropython device that can trigger inputs and outputs of the device under test in an automated fashion. For a generic micropython test suite we will have to focus on a minimum set of MCU / DUT signals we want to test on everything and make the tentacle board handle them. Too little capability and we won't try enough to bring value. Too much capability and we'll never finish designing and building it! Start small, get it working, grow over time. |
Beta Was this translation helpful? Give feedback.
-
I haven't tried this, but it's another vote for using rp2040 as the tentacle processor: https://github.com/dotcypress/ula If needed, the PIO can act as a logic analyser, could possibly replay lots of things too |
Beta Was this translation helpful? Give feedback.
-
microOctopus should - at least in the first versions - just implement the infrastructure on the tentacles which is:
Now everybody may assemble tentacles: Implement scope/playback mechanisms as @andrewleech and @Josverl described. So the primary questions for me are: How to build a generic tentacle that may cover the most important use cases. A test setup to test I2C slave functionality, for example clock streching, could be:
Testprocedure
Questions about the tentacle design in this early conceptional phase:
Start small, get it working, grow over time. |
Beta Was this translation helpful? Give feedback.
-
I would suggest starting as simple as possible; don't try to connect the 'tentacles'. Deploy firmware to the DUT (latest build) and ATE (last stable build) from the connected computer using the normal tools for the devices (esptool, dfu etc). Everything should be automated, there should be no human in the loop. Drop other external devices, they can be added later. Just use a micro to observe another micro - it's the best bang-for-buck though we won't be able to test everything. Aim to test something like GPIO, SPI, I2C, PWM, UART first, Timers, ADC, WDT, Networking next. Add others as we run into issues (like the recent rp2 thread issue) or as motivation dictates. I'd also drop the opto's and just directly connect GPIO's. The fallback should be to reset the DUT and ATE in a clean state. 100% agree with starting small. :) |
Beta Was this translation helpful? Give feedback.
-
I just had a look at https://pybricks.com. Very cool! Congratulations!
I completely agree. To be able to automatically deploy firmware, we already have to design our ATE hardware. Requirements are
Why not just take 1 USB connection which connects to the currently active DUT? My current approach is to provide USB on the ribbon wire bus (the inkbus which connects the tentacles). Only one tentacle at the time is allowed to connect to these USB wires.
But do all micropython devices work with USB 1.0? Exactly this would be my starting point: Use a long ribbon wire and USB 1.0 and start how you suggested: Deploy firmware to the DUT from the connected computer using the normal tools for the devices (esptool, dfu etc). What is your opinion?
|
Beta Was this translation helpful? Give feedback.
-
Hi, The difference was that I had to test only one device (with a lot of evolution). The choice was the pynqZ2 FPGA development board. Inside the FPGA there's an ARM9 (Zynq PS) and inside the ARM9 there's a python notebook jupyter that can dynamically modify the Logic part of the FPGA (Zynq PL) But there's also a ready-to-use tool: Logic tools https://pynq.readthedocs.io/en/v2.3/pynq_overlays/pynqz2/pynqz2_logictools_overlay.html Unfortunately, I couldn't go any further than just trying it out, as other tasks were more pressing. The board costs 230€ (it's expensive) and the Vivado development tool (when you need to make in-depth modifications) isn't easy to understand (for me), but it's a bit like micropython: you can do everything in python (it's fun. It's just to share, if it's off topic then sorry) |
Beta Was this translation helpful? Give feedback.
-
And only usb 1.0? I still see validity in MCU-device testing |
Beta Was this translation helpful? Give feedback.
-
Hi micropython core developers!
I was working for the last four years for a quantum computing company (zhinst.com) building fully automated testenvironments for complex hardware devices.
In a few years, I will be retired and then I will even have more time to do fun stuff.
Lets talk about a vision: microOctopus!
Main goals
Benefits
Sketch of microOctopus
https://github.com/hmaerki/experiment_microoctopus
Questions to the core micropython developers
Beta Was this translation helpful? Give feedback.
All reactions