Is there any better option that PI4J to write/read from UART in raspbian? - raspberry-pi

i'm looking for a better way for UART I/O in my raspberryPI in the linux side where i'm using Java.
now i'm using PI4J (wiringPI) but i'm facing few problems, i noticed many missing messages.
Also it's limited to 57600 baud rate and i wish to use higher.
So i was wondering if there is another well tested way to communicate.
In the other side i run c on cc2530 which run perfectly.
My main problem is in the java side where some messages get lost.
Thanks

I'm not sure of the exact Zigbee module you're working with, but this summary of the CC2530 says that it supports UART and SPI. Perhaps you can check the documentation for the module you're using and see if SPI might be a better alternative. Depending on the 2530's capability, SPI can be much faster than 57600.

Ok Found the JSerialComm which give what i needed.

Related

How to send IPMI commands over I2C?

I am looking into trying to run ipmitool over I2C and was wondering if this is supported. I have a raspberry Pi connected via I2C to another device that has a BMC. I have the character device /dev/i2c-1 which I can use to write I2C commands to but I am hoping to be able to send IPMI commands instead, such as with ipmitool.
If I connect the Pi and other system both to the same network, I can still send commands over ipmitool's lanplus interface but that is not what I want to do. I would like to see if sending them over I2C is possible.
Most commands I run with ipmitool seem to attempt to open the file /dev/ipmi-N which doesn't exist on my raspberry pi. I checked the driver support in the kernel for getting that (https://www.kernel.org/doc/html/latest/driver-api/ipmi.html) and made sure that my kernel has ipmi_msghandler, ipmi_devintf, and ipmi_ssif compiled into it. But still no luck. I suspect the issue is that I haven't correctly configured the ipmi_ssif driver on the kernel command line. Am I on the right path with this? I determined the i2c address with i2cdetect -y 1 and it shows up as 0x10. Dumping the file cat /sys/class/i2c-adapter/i2c-1/name shows me that my adapter is bcm2835. This led me to try to add ipmb_ssif.addr=0x10 ipmi_ssif.adapter=bcm2835 ipmi_ssif.dbg=1,2,4,8 ipmi_ssif.dbg_probe=1 to the kernel command line. However, I didn't specify anything for ipmi_ssif.slave_addrs, ipmi_ssif.tryacpi, or ipmi_ssif.trydmi which admittedly could be my problem. I don't know if it could also be just something with the raspberry Pi maybe not having some support for this or something. Any ideas?
I also tried the driver ipmi_si, although the Pi doesn't seem to have the hardware support for this. I suspect that's trying to access a BMC locally instead of trying to go over I2C. Since the ipmi_ssif talks about going over an SMBus that seemed like the one that I wanted.
I did also looked through some of the other interfaces that ipmitool supports and went down a bit of a rabbit hole with the ipmb-dev-int driver (https://www.kernel.org/doc/html/latest/driver-api/ipmb.html) since that also looked promising and originally mistook it for imb interface. But it doesn't look like ipmitool has that as an interface. But perhaps there is another one there that might be a better option for what I am trying to do. Maybe the free interface for working with freeipmi?
Any ideas would be greatly appreciated!
I posted a similar question to the folks who maintain ipmitool https://github.com/ipmitool/ipmitool/discussions/296 and one of the maintainers there helped me out by pointing me to another ipmb driver https://github.com/Mellanox/ipmb-host that looks like I might be able to use in combination with the OpenIPMI interface.

Adress external Hardware directly without driver?

Is it possible to access external hardware without using a driver, i.e. not having the driver abstraction layer in between program and external device?
Can you use a device by implementing your own driver-like controlling/handling directly in your program code?
I'm trying to understand a program that implements a Modbus protocol and some very specific Modbus configurations. Now I don't know how exactly it communicates with the Modbus devices.
It looks to me that this is very similar to what a driver does.
But can it even communicate DIRECTLY with the device without having a driver installed?
Yes, there are several micro-kernel OS's that always configure this way -- drivers are entirely implemented outside of the kernel.
The first thing you likely need is to get access to the device's registers; typically performed with mmap(), you may need to dig around a bit to find the right settings for cacheability, etc...
Second problem is interrupts. Unless you are running something like QNX, you won't have a way to have interrupts signal your program directly. You will probably have to turn them off and poll the device periodically.
If you are using linux and need io ports (inb, outb, etc...) man ioperm for more information.

What software can I use to simulate cellular connection

We need to do some stress testing of our system, and we would like to be able to simulate non-ideal situations: things like latency, jitter, etc. In particular, we would like to simulate behavior of data over a cellular network.
Do you know of any hardware/software/both solutions that would work?
Thanks
Ideally you would get some idea about parametrization from a real simulator like ns3. Or write one yourself.
Additionally you could use the Linux kernels built-in QoS stack which provides the netem module which can be used for these purposes. netem provides network emulation functionality for testing protocols by emulating the properties of wide area networks. The current version emulates variable delay (jitter), loss, packet corruption, duplication and re-ordering. It supports distribution based opteration or you could script it to change certain values during run time.
Wifi card with an older access point/router, simply take the test station to the edge of the range and you should be able to reliably cause the connection to fail and reconnect. Only reason I sugest an older model is that the range generally weren't that fantastic on the older "802.11b" stuff.
But other than just being a lossy connection, I am not sure you'd be able to use this setup to test certain characteristics of a cellular connection, but it should work.
If you are in the US, an iPhone on AT&T would probably do it..
Probably need something along the lines of:
USRP Board, OpenBTS, TrixBox/Asterisk
You can check out OpenBTS(http://openbts.sourceforge.net/) and see if it will do what you need. You could have it use the USRP board as a tower, then use it similar to a loopback. I do know that the above combination will allow phones to connect to it like a cell tower(See BurningMan/DEFCON 18), so in theory it should allow you to broadcast out to saturate the spectrum.
OpenBTS-UMTS include 3G data http://openbts.org/w/index.php?title=OpenBTS-UMTS
You can download and compile on Ubuntu 16.04, there is some issue with dependencies on Ubuntu 18.04.
About hardware, i used both Ettus USRP N210 and X310.

Looking for a Wi-Fi microcontroller to use with a robot

I want to make a Wi-Fi controlled robot.
After a lot of research, I decided to use an Asynclab's BlackWidow which was the best way for me to do this.
But unfortunately, this product is out of stock everywhere!
I ordered one on roboshop and I got the message 25 days later: Sorry, this product is sold out.
So, I'm looking for another microcontroller with a Wi-Fi interface.
I also need this very quickly (because it is for a school project), and it must be as cheap as possible.
I've been looking all the day but I couldn't find something as "good" as the BlackWidow.
You can get the WiFly shield from sparkfun.
In the past I have used a Linux router (with positive results) with Gargoyle (OpenWrt based) as a wireless gateway and communicate with it through a serial port, as most of them attach a console to the serial port so that you just have to send the command and '\n' to be executed. With the cURL libraries should be fairly easy to communicate without much effort with whatever you want.
You have the power of Linux and a pretty powerful CPU, can configure it through the command line or web page, and most important, a lot of routers are much cheaper than the 'BlackWidow'.
The one I used is the Fonera+ (unmounted doesn't take much more space than an Ethernet Shield) and used to cost around $28 although it is now deprecated, but some other routers from Linksys, TP-Link, etc. are also compatible as stated in the OpenWrt Compatibility Table.

Interface between a DSP/Microcontroller and a PC application

I'm using a DSP to control a sensorless brushless DC motor, The DSP is on a board which has a parallel port and a jtag connection (it's an eZdspTMS320F2812). What would be the best way to communicate between a PC application and the DSP as it was running? Ideally I'd like to have a GUI program with buttons like start, stop, accelerate, decelerate... but I've never done anything like that before. Which ports and method would be easiest to use?
Thanks
You can also use simple RS232 communications. I use always because it`s cheap and easy to implement.
The RS232 transceivers are very cheap (like MAX232 from Maxim-IC), and easy to use. Also they come in many packages like DIP or SOIC for example and can be found almost every electronic shop.
You can use any USART from your microcontroller to link with MAX232. Then, using a PC serial-usb converter (or if your PC does have a serial port it`s easier), you can use serial port programming from any programming language to develop your desktop application.
After that, all you have to do is create a protocol to exchange data between your PC programm and your DSP (some simple commands to start, stop and change motor direction for example).
Good luck in your project.
The parallel port is probably the easiest route. Depending on what OS and programming language you are using you should be able to find example code or libraries to support bi-directional communication via the parallel port. Since you have a small set of commands that you might want to send to the DSP board then you can probably just send a single character to the board for each command, e.g. 'R' = start, 'S' = stop, etc.