Jump to content

OpenScope MZ firmware source code


Recommended Posts

Hi @Ravi Kumar,

I am going to need more information from you in order to proceed with this issue. I haven't been able to replicate your issue unfortunately; I've made a few additions to the OpenScope source, built and flashed the device and can trigger the scope instrument.

Can you tell me what Arduino version you are running? Have you made any changes to the OpenScope source code? After uploading your custom firmware, have you calibrated your OpenScope? Your answers to these questions should form a foundation from which we can build an understanding of the issue you are experiencing.

Regards,
Andrew

Link to comment
Share on other sites

Thank you @JColvin and @AndrewHolzer for the much awaited reply. 

@AndrewHolzer I am using arduino 1.6.9 as written in the markdown file in github repository https://github.com/Digilent/openscope-mz.

I just compiled code without additions. (I haven't added code yet but I wish to)

CALIBRATION FAILED, I could load the saved calibration though and I couldn't trigger oscilloscope.

Also I've observed that the firmware compiled in my PC doesn't automatically load the wifi and calibration settings from the flash but the directly downloaded firmware does it.

I want to interface raspberry Pi with OpenScope MZ via serial monitor. but the baud rate of OpenScope MZ serial monitor is too high (1250000) I want to change it to 115200. which is why I wanted to edit the code. 

I don't know if there is any other way to interface RPi with OMZ other than Wifi and Serial. 

if there is a single board computer product by digilent which can have a serial interface at 1250000 baud rate, kindly mention.

Link to comment
Share on other sites

Hi @Ravi Kumar,

I am going to need some more information from you. What version of the Digilent Agent are you running? Can you connect from your PC to the OpenScope using a terminal application (puTTY, TeraTerm, etc.) and see what the output is booting your compiled firmware, and share the results? How recent was the last time that you synced your copy of the firmware source with the Digilent repo (in case you've had it a while)? Can you enable the console logs, and see the output in your browser's developer tools when you try to calibrate your device? I am curious to see what error code you get when trying trying to do so. I would also like to suggest changing something in the versioning info in Version.c, as an easily verified change in the firmware. 

It is curious how the issues are presenting themselves. I've tried to replicate your issues as best I can, but I haven't been able to do so. I can confirm, with firmware built on my home desktop, that my device can do what you say yours can't. Either way, together, we'll get to the bottom of this.

Link to comment
Share on other sites

I think I found the problem. the device running compiled firmware v1.29 was not able to load the calibration file created using firmware version 1.30 yet it showed status code 0 for calibration load JSON command.

This was the situation before calibration

Webp.net-resizeimage.jpg

OpenScope v1.296.0
Written by: Keith Vogel, Digilent Inc.
Copyright 2016 Digilent Inc.

File Systems Initialized
MRF24 Info -- DeviceType: 0x2 Rom Version: 0x31 Patch Version: 0xC

USB+:     4825178uV
VCC  3.3: 3297119uV
VRef 3.0: 2998535uV
VRef 1.5: 1500000uV
USB-:    -4776400uV

Using calibration from: UNCALIBRATED
Unable to connect to WiFi AP. Error 0xA000001B

Enter the number of the operation you would like to do:
1. Enter JSON mode
2. Calibrate the instruments
3. Save the current calibration values
4. Manage your WiFi connections
5. View all files names on the SD card
6. View all files names in flash
7. Set the Oscilloscope input gain

{"mode":"JSON","statusCode":0,"wait":500}
{"device":[{"command":"calibrationLoad","statusCode":0,"wait":500}]}
{"awg":{"1":[{"command":"setRegularWaveform","statusCode":0,"actualSignalFreq":1000000,"actualVpp":3000,"actualVOffset":0,"wait":0}]},"osc":{"1":[{"command":"setParameters","statusCode":0,"actualVOffset":9,"actualSampleFreq":10000000,"actualTriggerDelay":0,"wait":0}]},"trigger":{"1":[{"command":"setParameters","statusCode":0,"wait":0},{"command":"single","statusCode":0,"acqCount":1,"wait":-1}]}}
{"awg":{"1":[{"command":"run","statusCode":0,"wait":500}]}}
{"awg":{"1":[{"command":"getCurrentState","statusCode":0,"state":"running","waveType":"sine","actualSignalFreq":1000000,"actualVpp":3000,"actualVOffset":0,"wait":0}]},"osc":{"1":[{"command":"getCurrentState","statusCode":0,"acqCount":0,"actualVOffset":9,"actualSampleFreq":10000000,"actualGain":1,"triggerDelay":0,"actualTriggerDelay":0,"actualBufferSize":30000,"state":"armed","wait":0}]},"trigger":{"1":[{"command":"getCurrentState","statusCode":0,"acqCount":1,"state":"armed","source":{"instrument":"osc","channel":1,"type":"risingEdge","lowerThreshold":0,"upperThreshold":100},"targets":{"osc":[1]},"wait":0}]}}
{"osc":{"1":[{"command":"read","statusCode":2684354571,"wait":0}]}}

After I opened wavesforms live and calibrated the instrument again (As there was error message "Error loading calibration")

{"mode":"JSON","statusCode":0,"wait":500}
{"awg":{"1":[{"command":"setRegularWaveform","statusCode":0,"actualSignalFreq":1000000,"actualVpp":3000,"actualVOffset":0,"wait":0}]},"osc":{"1":[{"command":"setParameters","statusCode":0,"actualVOffset":-49,"actualSampleFreq":10000000,"actualTriggerDelay":0,"wait":0}]},"trigger":{"1":[{"command":"setParameters","statusCode":0,"wait":0},{"command":"single","statusCode":0,"acqCount":1,"wait":-1}]}}
{"awg":{"1":[{"command":"run","statusCode":0,"wait":500}]}}
{"awg":{"1":[{"command":"getCurrentState","statusCode":0,"state":"running","waveType":"sine","actualSignalFreq":1000000,"actualVpp":3000,"actualVOffset":0,"wait":0}]},"osc":{"1":[{"command":"getCurrentState","statusCode":0,"acqCount":1,"actualVOffset":-49,"actualSampleFreq":10000000,"actualGain":1,"triggerDelay":0,"actualTriggerDelay":0,"actualBufferSize":30000,"state":"triggered","wait":0}]},"trigger":{"1":[{"command":"getCurrentState","statusCode":0,"acqCount":1,"state":"triggered","source":{"instrument":"osc","channel":1,"type":"risingEdge","lowerThreshold":0,"upperThreshold":100},"targets":{"osc":[1]},"wait":0}]}}

Anyway, I guess I have to calibrate everytime I load the firmware. 
This line was misleading

{"device":[{"command":"calibrationLoad","statusCode":0,"wait":500}]}

It actually didn't load the calibration I guess.

But now the issue is that I am not able to save calibration info (Changed baud rate to 115200 so I can't use wavesformslive/digilent-agent)

Calibrating instruments
Connect DCOUT1 to OCS1 and DCOUT2 to OCS2
To connect DCOUT1 to OCS1, wire the solid red wire to the solid orange wire
To connect DCOUT2 to OCS2, wire the solid white wire to the solid blue wire
Enter C when ready
Starting Calibration
Calibration time was: 28190 msec
Do you want to save this calibration Y/N?
Unable to save calibration info for DCOUT1 Error: 0x80000003

Please debug issue of how to save calibration.

Link to comment
Share on other sites

Hi @Ravi Kumar,

Thank you for supplying these log outputs as they've proved helpful in finding a solution that should work for you. I took a look through the source code and found that the OpenScope will attempt to save the calibration configuration to the SD card when using the terminal UI, which fails if you don't supply an SD card . I confirmed that I received the save error as you have demonstrated and after a small change that I'll describe to you I saw the error disappear. 

If you look at line 811 inside IO.cpp, you will see a call being made to CFGSaveCalibration . You can configure the device to save to the flash by changing the second & third arguments to VOLFLASH and CFGFLASH respectively. Let me know what results you get when you make the same changes here. 

Link to comment
Share on other sites

Thanks ! but I have to perform calibration every time I have to upload firmware. It doesn't load saved calibration from flash from the previous build. Why ? Does it get deleted when there is an upload ?

It would be nice if I can load calibration from a file. Do I need SD Card for that ?

Link to comment
Share on other sites

You will have to redo the calibration every time you program the OpenScope with the Arduino tools. It isn't preserved through the process. You can possibly re-implement the firmware upgrade flow in WFL, which will allow you to preserve the calibration settings that have been saved in flash.

Otherwise you can save to an SD card as well. We intended that user calibration exist on the SD card and manufacturing calibration be kept in flash, but both can be overwritten by the user, anyways.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...