NIOSII with Remote System Update IP Core for Cyclone10LP does not execute - intel

I am working on an update procedure for the Cyclone10LP FPGA with Quartus Prime 20.1.1.
The platform design is done the following.
The NIOSII Software Build tool for Eclipse Project is configured according to the .sopcinfo file. The NIOSII soft core works properly.
However, executing the Altera provided HAL function altera_remote_update_trigger_reconfig(...) does not trigger the Remote System Update (RSU) for reconfiguration. A verification of the RSU was also done with discrete logic, there it works properly.
My code looks like the following.
int main()
{
altera_remote_update_state sp;
sp.base = REMOTE_UPDATE_0_BASE;
usleep(500000);
altera_remote_update_trigger_reconfig(&sp, 1, 0x800000, 0);
/* Event loop never exits. */
while (1);
return 0;
}
Any idea why the RSU does not work?

Verify, if the right address offset is used in the altera_remote_update_regs.h according to the Remote Update Intel FPGA IP User guide.
I had to adapt the address offsets of the registers. (Hint: the RU_BOOT_ADDRESS register from the User guide is the ALTERA_RU_PAGE_SELECT_REG in the altera_remote_update_regs.h.) It seems that the board support generation does not adapt all the needed parts.
Further details about the RSU on the basis of a Cyclone iV see: http://billauer.co.il/blog/2017/06/remote-update-intel-fpga-cyclone-iv/

Related

Problems with telemetry (jtimon/Telegraf) on Juniper OS (Junos)

we are trying to set some telemetry environment on a Juniper VMX (virtual) router located on AWS.
We configured the router following the documentation, and tried to get some telemetry data from it via jtimon and Telegraf.
The gRPC connection is established and we do receive data, but not exactly what we want. Before continuing, I'm sharing the configuration that we use :
Router configuration (telemetry-related) :
system {
services {
extension-service {
request-response {
grpc {
clear-text {
port 32767;}
skip-authentication;
}
}
notification {
allow-clients {
address 0.0.0.0/0;
}
}
}
}
schema {
openconfig {
unhide;}
On Telegraf, we have these settings (for example) :
[[inputs.jti_openconfig_telemetry]]
servers = ["10.0.100.202:32767"]
sample_frequency = "10000ms"
sensors = [
"15000ms /junos/system/linecard/cpu/memory"
"2000ms /components"
]
collection_jitter = "0s"
flush_interval = "15s"
flush_jitter = "0s"
precision = ""
debug = true
quiet = false
Basically, our sensors gets created on the router, and we can see them with the show agent sensors command. What we cannot understand is that if we change the sensor in the configuration file of Telegraf, we will still receive the information of all previously subscribed sensors. To be clear : in the example, we subscribe to /junos/system/linecard/cpu/memory and /components. If I delete these lines, subscribe to /interfaces and run Telegraf, we will receive the information from the 3 sensors (/components, .../cpu/memory and /interfaces).
As we understand, this is due to an "ephemeral-configuration" called "junos-analytics", as written in the official documentation :
Starting in Junos OS Release 18.2R1, when an external streaming server, or collector, provisions sensors to export data through gRPC on devices running Junos OS, the sensor configuration is committed to the junos-analytics instance of the ephemeral configuration database, and the configuration can be viewed by using the show ephemeral-configuration instance junos-analytics operational command.
Thing is, we don't understand how to edit/disable/delete this "junos-analytics" instance. From what we see, some new sensors (sometimes with the exact same path) get created (with a different sensor ID / name) everytime we run Telegraf. We don't know how to delete them (we tried with a delete services analytics sensor *sensor_name* but it resulted in a "statement not found" error message...).
To sum up, we do receive our sensors' data, but it comes in the middle of lots and lots of other (useless) previously subscribed data.
I feel like we might be missing something in the router configuration, as Telegraf and jtimon show the same behaviour/results.
Any help is appreciated, I can of course share more information if needed ! Thanks in advance :)
Just in case someone is having the same problem : we contacted the Juniper support, they asked us to upgrade our Junos version (from 18.2 to 19.X) and that solves the problem !

How does telegraf input plugin like [[inputs.mem]] fetch data?

When we need memory related stats we add input plugin in telegraf.conf file.
[[inputs.mem]]
For application stats we keep input as statsd, we push stats from application using UDP to telegraf using its host and port.
[[inputs.statsd]]
Could someone explain how does [[inputs.mem]] input plugins get data related to memory? Because no one is pushing data to telegraf in this case.
Telegraf retrieves system data using system libraries written for Go. At this time it is using the gopsutil library. This library's link above includes an example of how it could be used within any Go program.
func main() {
v, _ := mem.VirtualMemory()
// almost every return value is a struct
fmt.Printf("Total: %v, Free:%v, UsedPercent:%f%%\n", v.Total, v.Free, v.UsedPercent)
// convert to JSON. String() is also implemented
fmt.Println(v)
}
This library supports a number of different operating systems and has modules for a variety of system information such as cpu, memory, disk, and networking usage. You can see where these are incorporated into the telegraf project here.

setting static IP for wifi connection in QT

I am trying to create a QT based application that scan and connect WiFi networks. I am using this example as a reference code.
Is it possible to assign static IP for the WiFi connection using QNetworkConfiguration or any related class ?
How to authenticate the networks that are password protected ?
thanks in advance......
I have created a net work session using the below code set..
void BearerMonitor::createNewSessionFromQml(QString ssid)
{
QList<QNetworkConfiguration> allConfigurations = manager.allConfigurations();
while (!allConfigurations.isEmpty()) {
QNetworkConfiguration config = allConfigurations.takeFirst();
if(config.name()==ssid)
createSessionFor(config);
}
}
SessionWidget::SessionWidget(const QNetworkConfiguration &config, QObject *parent):QObject(parent)
{
session = new QNetworkSession(config, this);
session->open();
}
No you can't. At least not with just Qt APIs.
Please read this and in particular this. QNetworkConfiguration is just a facility to manage network configurations. Editing such configurations is demanded to native code / OS interactions. From the second link:
Note that the QNetworkConfiguration object only provides limited information about the configuration details themselves. It's main purpose is to act as a configuration identifier through which link layer connections can be created, destroyed and monitored.
Even the "start/stop network interfaces" claim is not entirely true since such a feature is available only in certain OSs (not the mobile ones). See the "Platform capabilities" section of the second link for more details about that.
The same reasoning applies to the password question. Once a network is registed in the OS with the corresponding password (because of native code or the user physically registering it) a new configuration is available to the NetworkConfigurationManager, granted that the list of configurations is updated via updateConfigurations(). The new configuration contains the password but you can't edit it from Qt APIs.
Native code is the only solution, as said. Still, Apple does not want you to mess up with WiFi programatically since private APIs for that cannot be used in iOS > 5.1 (the oldest version supported by Qt as for Qt 5.4).

best way to get a volume serial number in an asp.net application?

I work on an ASP.Net application which is a web version of an already existing winforms desktop application. The desktop application reads a license file defining enabled features to adapt its behavior. To lock the application to a specific machine, one of the setting of the license file is the serial number of the first system volume. At startup the application checks that the serial number in the license file matches the volume serial number. Getting the volume serial number is done by PInvoking kernel32.dll's GetVolumeInformation function.
However in the asp.net version a standard application pool using a local service or local network identity does not have permission to PInvoke, resulting in the impossibility to check the license file is valid. How can I check the license at the application startup?
I can think of the following alternatives:
replacing the PInvoke by a method which does not require special permissions to get the volume serial number (is it the case with WMI?)
putting all the license checking code in a separate assembly and install it to the GAC to have it executed elevated
creating an application pool with administrator identity just for my application during the installation process
The first solution would be the best but I don't know if it is possible.
Have I other possibilities? What are the pros and cons of each method? Which one is the best?
I suggest using WMI. The Win32_Volume class has the serial number of the volume. You can use something like this:
using System.Management;
SelectQuery query = new SelectQuery("Win32_Volume");
ManagementObjectSearcher searcher = new ManagementObjectSearcher(query);
foreach (ManagementObject obj in searcher.Get())
{
Console.WriteLine("{0} {1}", obj["DriveLetter"], obj["SerialNumber"]);
}

Read weight of package from a Fedex scale within web application?

I've been asked if I can read the weight from a scale, connected via RS232, and dump it into a web application. Reading the weight of the scale from the local machine isn't bad (this SO question gives an explanation: RS232 question - how to read weight to PC), but...
How do I then get that data to paste into a box in my web application...? Ideas?
I'm running into a similar-but-reverse situation with Fedex and UPS labels. I can get the label data within the web application, but I need to send that data via a raw printer socket (i.e. I can't just File > Print) to the local printer... how?
FedEx and UPS now how Zebra printers that can be network attached. Printing to them is easy via .NET and the standard Windows Spooler using the UNC path to the printer. The trick is how to expose the printer to your web application. If you web application is on the same network as your printer (intranet), the answer is simple. Send the data to the printer via the Windows Spooler from your web server in a server side call from your web app clients. If your web application is hosted outside of your local network, stand up a web service and write a web service to receive the ZPL (Zebra Printer Language) from your web app. The web service would also use the windows spooler to send to the printer on the same network.
Usually web applications are unable to communicate directly with a PC unless there's a full trust between the server and the client. Even then, web pages lack the ability to talk to peripheral devices for myriad security reasons. For a problem like this, you'd almost have to run some kind of client/service background application on the PC.
For the print from web app functionality, QZ Tray is a little java app that does the heavy lifting for you. You can snakeoil a cert, too, instead of paying for their custom cert for their silent printing.
I've been asked if I can read the weight from a scale, connected via RS232, and dump it into a web application.
Although this can't be done directly through JavaScript, a custom client-side or server-side solution can help. There are some server-side and desktop products which expose this functionality to a webpage (RS232 scales, USB scales)
To elaborate specifically on Gordon's recommended QZ Tray approach (assumes the PC has QZ Tray installed; assumes the page has been configured to use QZ Tray), here's a technique which will work for a serial port connected to a Mettler Toledo scale. The commands vary between scale suppliers, so adapt as needed.
Disclaimer, we're the authors of QZ Tray.
Connect to COM1, send command, disconnect
// MT = Mettler Toledo. Change as needed.
var port = 'COM1'; // <-- COM1, '/dev/ttyUSB0', etc
var cmd = 'W\n'; // <--- MT Weight command
var baud = {
baudRate: 9600,
dataBits: 7, // <--- MT Changed from 8
stopBits: 1,
parity: 'EVEN', // <--- MT Changed from NONE
flowControl: 'NONE'
};
var delims = {
begin: '\x02', // <--- MT start of message
end: '\x0D', // <--- MT end of message
width: null // <--- MT doesn't use width
};
qz.serial.openPort(port, delims).then(function() {
return qz.serial.sendData(port, cmd, baud);
}).catch(function(err) { console.error(err); } );
qz.serial.setSerialCallbacks(function(evt) {
if (evt.type !== 'ERROR') {
console.log('Serial', evt.portName, 'received output', evt.output);
} else {
console.error(evt.exception);
}
// Close port
return qz.serial.closePort(evt.portName);
});
I'm running into a similar-but-reverse situation with Fedex and UPS labels. I can get the label data within the web application, but I need to send that data via a raw printer socket (i.e. I can't just File > Print) to the local printer... how?
Duplicate of https://stackoverflow.com/a/28783269/3196753.

Resources