Close

Read why? Box0 is by design (and implementation) is powerful

A project log for Box0

Free and open source tool for exploring science and electronics anytime anywhere

kuldeep-singh-dhakaKuldeep Singh Dhaka 04/18/2016 at 03:000 Comments

So, everyday somebody is designing using serial2usb (ex: FT232) and a microcontroller.

Serial is simple, useful and easy to use. BUT


Problem1

Suppose, these devices have multiple functionality (ex: GPIO, SPI, I2C) but they have to be controlled over one Serial interface!.

Only the process (which opened the serial device) can use all functionality.

No two diffrerent process can control {1st process: GPIO, 2nd process: SPI} in parallel because the device use serial.

Last resort: cram all code in one process.

TADA: say bye-bye to modularity and mantainibility while saying hello to increasing complexity and bulk-code

Parallel communication is not possible/practical via using Serial because

Problem2

Inherit design of such device are not build while keeping parallelism in mind.

example: designer consider copying using CPU instead of DMA (because it is easier).

Note: CPU could have done something else while DMA is copying.

Problem3

serial2usb like IC addup cost. (they cost similar that of a micrcontroller)

Today usually all microcontroller comes with ADC, USB, SPI, I2C. These are not special parts now.

Even if USB peripherial is there, peoples are happy with implementing [serial over

USB] with it. :/

Problems Conclusion

Everybody and their dog is happy by using serial2usb like IC but not all case justify them.

Solutions

Solution to Problem1

Box0 by inherit design and implementation have concept of modules.

A Box0 device can have multiple Box0 modules.

All modules are independent of each other (there is no coupling)

So, if you familiar with "USB interfaces". all Box0 modules are provided as "USB interfaces".

Now, by taking permission from kernel, the process can communicate with the specific interface (which is a Box0 module) instead of taking control over the full device.

So, now, if there are 5 modules in a device, 5 process can control them independently. YaY!

(or 1 process can take control over 5 modules - if you want to)

AFAIF, in 90's serial was replaced by USB for such reasons.

Solution to Problem2

Since Box0 by design have parallelism and use abstract interface for communication.

even though STM32F072 is a "low end" microcontroller, using DMA, interrupt, timers like peripherial, all modules (ie USB interface) can work in parallel.

example:

  1. CPU initalize Timer, ADC, DMA
  2. CPU start timer (and goes to do something else)
  3. timer give trigger to ADC
  4. ADC after data-ready give trigger to DMA
  5. DMA copy the data to RAM
  6. goto 3 until required number of samples captured.
  7. done: DMA generate a completion interrupt
  8. CPU service the interrupt and send the data of to host (and goes to do something else)

If work is not available, CPU (only) goto "sleep"

Solution to Problem3

As you readed in solution to problem{1,2}, there is no serial2usb IC.

Conclusion

So, while reducing cost by not using serial2usb like IC, box0-v5 is more powerful because of its inherit design and implementation.

This is why, one module (example AIN) can be opened in Python while AOUT one can be opened using Box0 Studio - Function Generator

Note

Box0 USB Specification - The Box0 Design specification

box0-v5 - A Box0 Implementation

Discussions