Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New feature : connection to bitscope-server via UDP & discover and store bitscope Serial Number #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

LoucIsZbib
Copy link

I wrote some lines of code to enhance your projet of scopething (driving bitscope directly from Python)

New features I add :

  • connect to bitscope-server using UDP layer
  • discover & store bitscope serial number

- connect to bitscope-server using UDP layer
- discover & store bitscope serial number
@jonathanhogg
Copy link
Owner

Hi @LoucIsZbib,

Thanks for this. The new features look useful, but I have a couple of comments on the implementation:

  • The UDP stream should probably pull out the sequence number on the reply packets and raise an exception if it gets an out of sequence packet; adding a reorder buffer sounds like more work than is probably necessary (and is the reason god invented TCP…)
  • I'd probably prefer that the serial number method goes into the Scope class instead of the VM class and used the underlying VM methods for setting variables and issuing an EEPROM read

Don't feel you have to do either of these things, I can just add them to my list of things to do if you've got other work to be getting on with.

@LoucIsZbib
Copy link
Author

Hello,
It's great my suggestions catch your attention :)
My main goal was to contribute back to a project I use and appreciate. If my work on it could be usefull to others...

For serial number, it can go in Scope class, it may have more sense. If you want to manage it, please go ahead.

For UDP packets orders, indeed raising an exception in case of packet loss or re-order mecanism could be usefull.
Indeed, in my first implementation, I didn't have any issue with packet loss/order. But I was working with small nsamples (< 2000). After, I tried with bigger nsamples ( ~ 12000), and in debug mode with Pycharm, I experiment packet loss (no pb with packet order). I was thinking of implementing a "please resend these packages", but working with buffer offset and registers is not my thing. So I'm now thinking about putting python/Scopething directly in the Rpi instead of the bitscope-server (which has many limitations like the number of simultaneous bitscope it can manage), and implement a higher-level TCP communication between the Rpi/bitscope/Scopething and my laptop. So I don't know if I will have time and interest to continue this UDP extension. Maybe for the packet loss detection, probably not for the re-order of packet.
I keep you informed in the next weeks.

@jonathanhogg
Copy link
Owner

I've used socat before to connect a Bitscope analyzer running on a Pi to the network via a simple TCP socket. This is actually why I added the socket URL type to the code.

The advantage of using TCP over UDP is that it's completely reliable. I'm not really sure why Bitscope went for UDP for their protocol – I guess it was just simpler to implement in their network-connected products…

I had originally intended to build scopething into a kind of "smart" multimeter using a Pi with a touchscreen, but as usual I got side-tracked. I also discovered that I could do everything I needed just connecting the device to my laptop and using IPython.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants