Unetstack C API with Unetsim simulator - unetstack

I am trying to run the C API for Unetstack. I have been trying to run the test code here.
I am running 3-node-network.groovy from the unetsim-1.4 sample code in my terminal to use as my modem network. I am using unetsim-1.4a for linux for my simulator.
This is how I call the test code:
make IP="127.0.0.1" ADDR=1 test
The test code is able to open the modem, but is not able to send packets through.
This is the error I end up getting:
Packet transmission: FAILED
Packet transmission: FAILED
Segmentation fault (core dumped)
and I do not see any received packets on my simulator shell.
When I run the 3-node-network.groovy simulation with the Python API, everything works fine, and I can see packets being received on my simulator shell.
How should I set up the environment to run the Unetstack C API test code to transmit and receive through a simulated modem network on unetsim?

Follow the steps below to set up the environment to test basic modem operations using UnetStack C API with simulated modem network on unetsim :
Run 3-node-network.groovy from unetsim-1.4 sample code which creates a simulation environment with 3 nodes deployed as shown below for example:
bin/unet samples/rt/3-node-network.groovy
Change the port number from 1100 to 1101 at this line in the code in your unet-contrib local repository.
Set the destination address to 2 at this line.
Set the carrier frequency to 25000 Hz at this line.
Navigate to this folder in your unet-contrib local repository and perform the following steps:
make c
c/examples localhost
You should be able to see successful transmissions from node 1 and corresponding receptions on node 2.

Related

How to access AT command mode on an Xbee Series 2 (Always)

I have two working Xbee pro series 2. Configuration went fairly smoothly and they connect on channel 15.
I want them to connect on Channel 11. However when I type "+++" on the terminal window "+++" gets sent to the other xbee module instead of me receiving the "OK" which I sometimes receive. What would be the surefire way to access the AT command config mode? (thanks in advance)

ARM Trustzone, Open Virtualization SDK Boot stuck

I am currently working on something related to ARM Trustzone so I found this Open Virtualization (http://openvirtualization.org/)
I followed the documentation over the Sierra TEE build and boot guide to build and it compiles without issues.
However when I am trying to boot the system, it seems it loops in the "normal world" forever and the log shows the following:
Trying 127.0.0.1... Connected to localhost. Escape charater is '^['.
SW: Entering Secure Main
SW: UART driver initialized successfully the mount file system is 32
and the value is 0 file system successfully mounted in FAT32 nsk
load:load addr = 80000000, startaddr = 90d00000, size = 3aedcc Done
tzhyp_guest_context_init:SW: dispatch task id 0x111
It seems it loops in the normal world forever and the boot process is stuck at this point.
If anyone happen to work on this before please help.

Nanomsg TCP Handshake

I also posted this in the Arduino section, but this problem is probably caused more by my ignorance of nanomsg and connections in general rather than an Arduino problem.
I am attempting to communicate with a server that is using nanomsg to communicate via TCP on a port using an Arduino. I have attempted a variety of different configurations (remotely connecting to the arduino and having the arduino connect to the server, using different nanomsg tools).
I can get the Arduino, in server mode (running a very slightly modified version of the WiFiWebServer example) to successfully read text I send using cat
sudo cat texttosend > /dev/tcp/192.168.1.50/80
However in all the configurations, and no matter what text I am trying to send using nanomsg, I always get a string of the same numbers. Printing the bytes as hex from the arduino, they are 0 53 50 0 0 51 0 0. Nanocat (the simple command line tool of nanomsg) hangs instead of sending and shutting down (like it is constantly trying to confirm the connection before sending the data).
I'm assuming this is some kind of handshake the Arduino is failing, because the client connects, reads those bytes, then shuts down and restarts. Using nanomsg on both ends (from my local computer to the server) works fine.
If these numbers I'm getting are a handshake, how do I complete it?
The meat of the loop part of the Arduino code is
client = server.available();
if (client) {
Serial.println("new client");
while (client.connected()) {
while (client.available()) {
byte b = client.read();
Serial.print(b,HEX);
Serial.write(b);
}
}
}
And the nanocat command that hangs when trying to connect is
nanocat --push --connect tcp://192.168.1.50:80 --data thismesadsfsdfg
The following text describes nanomsg protocol for TCP.
In it you can see why you're getting the specified byte stream and what you should write before the text you want to send.

How to implement Serial Port Profile Link Command used in ConnectBlue Bluetooth Module?

I am trying to implement Bluetooth using "connect-blue-oem-spa-331" module using UART protocol and using MSP430 as base controller. I'm using Embedded C as a language of programming.
Everything just works fine until I reach to Serial Port Link Command "AT*ADCP". Every time I get response as ERROR. I have tried with both options by keeping ECHO ENABLED and ECHO DISABLED.
p_cmd = "AT*ADCP=XXXXXXXXXXXX,0,0,0\r";
this is my command. 'X' represents the Bluetooth confirm device address which I confirm when I execute DEVICE_INQUIRY command.
The module through which I am executing all these commands is always MASTER and will initiate pairing and communication process. As a safety I have kept it non-discoverable.
How can I implement the Serial Port Profile Link command without getting error when I confirm the bluetooth device using DEVICE_INQUIRY command.
I have been working with blue tooth for last 4 months. I had faced above issue in early days. And after running through documentation available for product I solved the issue. I thought to reply this question which I've asked.
I was using Connect Blue OEM-SPA-331i classic Bluetooth module in my project, and was using Serial Port Profile to implement Bluetooth commands.
When I inquire devices I get the list of Bluetooth Devices available and discoverable in the vicinity(mine was CLASS-I Device); and lists them as (48 bit MAC Address,Class of Device) i.e. ( 001234ab987f,786545) of the discovered Bluetooth Module.
When I'm trying to establish Serial Port Profile Link, it was required that I must write address of peer device to be connected over Serial Port Profile in Serial Port Adapter. The order of the commands should be
Inquire discoverable devices
Write the desired peer device address to Serial Port Adapter, remember it in power cycles.
Establish Profile Link.
This way I resolved my issue of link not getting established.

Sending AT Commands from Microcontroller

I am in the middle of a project that is going to use a micro-controller to tell a Sierra Wireless Raven XT to send a test message to the appropriate admin when a pump fails. I have the interrupt for the pin change when the pump fails already completed. My problem is getting the modem to send the text message. I am able to send a text message when connected to the modem through putty or hyper-terminal but when I tell the micro-controller to send those same commands I get nothing.
I am using an ATmega88PA and programming in C. To send the commands over serial communication I am using USART. When I connect to the micro-controller through putty and fake a pump fail the message that is output to the terminal is the exact thing that I would need to type in to send the message myself.
Anyone have any ideas as to what might be holding me up?

Resources