Writing network driver for Raspberry Pi GPIO connected to FS1000A - linux

I want to create a Linux network driver for a FS1000A connected to the RasPI via GPIO. It does not need to support a high bitrate.
The hardware is already working, I've previously managed to emulate a 433 MHz remote control using a FS1000A transmitter connected to a Raspberry PI's GPIO pins. The FS1000A transmitter and receiver use on off keying. If the GPIO pin is set high, the transmitter transmits a carrier. If it's set low it does not transmit.
According to an article about writing virtual interfaces, "A virtual interface has no way to receive interrupts, and thus it cannot receive any network packet." Is it possible to receive an interrupt when a GPIO pin changes state on a Raspberry PI? If not it is possible for a network driver to get a callback to poll the state of a GPIO pin? It does not have to be elegant or efficient, it just needs to work.
Does a network driver's xmit function have to block until all the data is sent? That could take a long time the packet is transmitted 9600 bps.
I read a guide to writing network device drivers for Linux but it is focused on PCI devices. Is there any documentation/tutorials about writing network drivers for Linux?
Any other tips suggestions welcome.

Related

Reading signals on ethernet port directly with RaspberryPi

I have a device which connects to its remote using rj45 port and 4 wire cable (a desk with adjustable height). I'm pretty sure it does not actually use an Ethernet protocol and uses sends some simple digital signals.
I want to Raspberry Pi to be able to control the device, so I was wondering if it is possible to read and dump and then send signals using Ethernet port just like I can do with any other pins? Probably the actual question here is about a way to bypass Ethernet driver in Linux OS.
This won't work. The Ethernet NIC on the RPi - just like any other NIC - can only receive Ethernet frames. Anything else needs to be connected over GPIO.
Edit: As NO-OP has reasonably pointed out, the signals may need to be made compatible with the GPIO pins - levels adjusted, maybe an opto-isolator here and there. Nothing expensive though usually. For controlling powered devices you likely need a driver or relais board - there are plenty around for the RPi.

uart communication in Linux kernel

I have a UART-based device, ESP8266EX, and I need to write to its driver for Linux. Since I am new to writing kernel drivers is there any example or method for accessing uart reading and writing through kernel driver. How is it different from user space uart code?
I have a small iot board with mu device connected to /dev/ttymxc1 port so the uart port will remain fixed for this device and also the device will work at fixed 115200 baud rate. I should be able to read and write to uart from kernel.

Connecting I2C Device to Labview using NI-845x

I'm trying to connect a mass flow sensor, SFM-3000 by sensorion, to labview on PC using USB device, NI-8452, which provide I2C interface.
I followed the user manual of the sensor and used I2C example by labview but I cannot establish communication between them
I get the error message:
Error -301744 occurred at NI-845x I2C Run Script.vi:6110001,
Possible reason(s):
NI-845x: The I2C master lost arbitration and failed to seize the bus during transmission of an address+direction byte.
I'm using NI-8452 that include pull up resistor and I make sure to enable them by enabling 'Use Internal I2C Pullup Resistor' filled in 'NI-845x Device' property node.
I set I/O voltage level to 3.3,
I double check the address, I have 7 bit address defined in user manual of my device, 64 dec or 1000000 binary.
As specified in my device user manual, I provide it Vdd of 5v from NI-8452 pin 40 and also GND in pin 7.
Off-course SDA in pin 5 and SCL in pin 9.
I think I might have a problem with pull up reference voltage because the sensor specified it need to be 5v but NI-8452 use up to 3.3V.
but the low limit for high signal is 2.5v so it should work
My diagram:
another option i tried is using I2c script blocks
I tried similar solution also for pressure sensor, hdi0611arz8p5 by First-Sensor, but also got the same error.
After re-wiring it's started working, maybe some bad connectivity between wire and port. i hope this thread could help people that wish to connect sfm3000 using labview.

How to use APC220 Radio Communication Module in raspberry pi

I am developing a project using Arduino to send a message to Raspberry Pi using an APC220 Radio Communication Module.
The Raspberry Pi can't receive serial message by using USB connect to APC220. I want to know how to use APC220 in Raspberry Pi?
The APC220 has a TTL UART interface which you can connect directly to the RPi TTL UART pins on the GPIO header - you do not need the USB-Serial converter (though that should work too if it is a standard CDC/ACM device - though this suggests that there may be issues).
A note of caution however, the RPi GPIO pins use 3.3Volt logic, the APC220 datasheet is not clear on the TTL level used, but the specified supply range is 3.3 to 5.5 volts so it seems likely that it is 3.3V - best measure it to be certain. You can probably use the RPi GPIO headers's 3.3V supply pin to power the ACM220, then you will be sure to be safe. If the ACM220 level is too high, the quick-and-dirty solution is to use current limiting resistors in-line to protect the RPi (10KOhm should be enough, but don't hold me responsible; you should know what you are doing before proceeding).
The UART device on the Pi is /dev/ttyAMA0.
See here for details of serial I/O on the Pi.
22 Feb 2012 Update
The discussion here suggests that to make the TTL<->USB adapter work on Raspberry Pi, you need to disconnect the EN signal - the discussion links back to the manufacturer documentation, which gives that advice in the troubleshooting section. Since that makes the device appear as a USB serial, and you won't have to reconfigure the on-chip serial or build a connector that may be simpler.

Bluetooth: Uart or SPI?

My question is : what is the best method to drive a bluetooth module(BTM-331 as an example) over UART or SPI? I am asking this in the following context.
I have some analog sensors connected to a uP. The uP sends this data over spi to another uP who has also a bluetooth module. Because I talk with the sensors via SPI is ok to talk with the Bluetooth module with spi or uart is better?
I am pretty sure that even if you want to use it with SPI, you can't. I've used other BTM modules and the SPI on them is used for programming the module. Communication with it is possible through UART and (most of the times) USB.
Looking at the BTM 331 (description here) and it does say that USB and UART are the interfaces used.
Other than that it is fairly simple to use, you send data to it and the data goes to whoever the module is connected to. That is the least you can do with it but it is more than enough for most people.

Resources