I need to handle Serial UART (pins 8,10) for raspberry pi3, OS Windows 10 IoT - windowsiot

I nead to know the name of the COM port for UART0 (pins 8,10) on the raspberry pi 3.
I should run a c++ server (library for our control system is c++). So I need the device name for following
CreateFile("\\.\COMx",...); (or the name in other form)
In the case of rasperrian jessie OS I know how to enable it and what is the device name after enabling (http://spellfoundry.com/2016/05/29/configuring-gpio-serial-port-raspbian-jessie-including-pi-3/).
We would like to try also Windows 10 IoT for some of our raspberrians.
Any comments is apreciated.
Davit

So I need the device name for following CreateFile("\.\COMx",...); (or the name in other form)
Windows 10 IoT Core can also use CreateFile function in Windows IoT Core Console C++ project.
You can get the device name from the project SerialUART.
Then you can follow this instruction to try to get the device name like L"\\?\ACPI#BCM2836#0#{86e0d1e0-8089-11d0-9ce4-08003e301f73}".
At last you can create a windows iot core C++ project and use CreateFile("\\?\ACPI...",...); for getting file handle.
Link:
https://github.com/ms-iot/samples/tree/develop/SerialUART
https://developer.microsoft.com/en-us/windows/iot/samples/serialuart

Related

Writing a task in VxWorks

I am trying to understand how can I write tasks for VxWorks. I have VxWorks on a board that is mounted on a development board.
I can access the board through Putty and a serial terminal connected to the UART of the system. How can I write other tasks (maybe to communicate with other UARTs or other Serial Interfaces) ?
And how do I know where to find the documentation describing how I can access those serial interfaces? (for example write/read methods, which file to include etc)*
Thank you
VxWorks is cross development environment, so you need a licensed development system on Windows or Linux desktop to create applications.
Then you load the compiled code on the target reference board as process/RTP or LKM/DKM. How you get it there varies by board: FTP, TFTP, removable USB or SD card....
At the C shell on booted system you can start a task in the kernel context with any public symbol. But if your working with deployed system, it shouldn't have the C shell, that's a serious security risk :)
Try..
-> sp printf, "\nHello VxWorks World!\n"

connection between windows and Linux sockets in c

I am using the socket module in python to send commands to my raspberry pi to turn GPIO pins on and of.
I am switching to C, where I will use winsock.h and winsock2.h to create the server on my PC and sys/socket.h to create a client on the raspberry pi.
Is it possible to establish a connection between these two different libraries?
I only want to create a socket, bind, send and recv. No other operations.
I recommend you to check this documentation, there are some examples for a Windows Server / Client connection:
https://learn.microsoft.com/en-us/windows/win32/winsock/getting-started-with-winsock
For Linux you need to do some adaptations as you might know or you have already implemented, I did the same for 2 desktop applications to send data from a Linux PC (client) to a Windows PC (server). As mentioned in the comments it doesn't matter the devices while they are in the same network and follow the TCP/IP protocol.
I was able to do this even connected through a VPN. Unfortunatelly I can not share the code. But I developed this communication based on the documentation from the link above.
I hope it helps. Actually if you want to use Python in the raspberry Pi there is also a python built-in package that you could use: https://docs.python.org/3/library/socket.html
And you can use the code from the link above in Windows. It should be straighforward.

Writing a Windows driver for Pro Micro

First off I have very very little experience with how USB functions let alone writing a driver; essentially trying to make this project a learning experience.
My setup consists of the SparkFun Pro Micro board and a Windows machine. I have a potentiometer wired up to the Pro Micro and my end goal is to send the value of the potentiometer to the host machine and use the value to change things like system volume etc...
The Arduino library came with a Serial library and I can send things over USB using that. I currently have a working Arduino program that sends 1 byte every 1 second, and a C program on the windows machine that "connects" to the COM port and reads the byte coming through (this part I have working fine).
The issue is that when the Pro Micro is connected to the computer it appears on a randomly selected COM port and I don't think you can tell which COM ports hold which device (not sure about this bit).
My end goal is when the Pro Micro is connected to the PC the host program should automatically recognize the Pro Micro and start processing the data that is coming from it. Setting it up as a HID device and making it appear in Device Manager as my own custom device is something I'd be interested in doing, especially for the learning experience but I feel that it might overcomplicate things.
Can anyone point me in the right direction as to what I should do/look into?
maybe use windows internal tools like the COM port database (https://msdn.microsoft.com/en-us/library/ff546481.aspx) or re-assign COM ports using windows registry, see
How does windows map the virtual com port to a device
https://superuser.com/questions/851192/change-com-port-number-programmatically
http://www.ftdichip.com/Support/Documents/AppNotes/AN_132_Re-Assigning_COM_Port_Numbers_Using_Registry.pdf
if you want to know the backgrounds: the arduino implements the USB CDC ACM class (Communication Device Class - Abstract Control Model https://en.wikipedia.org/wiki/USB_communications_device_class) and emulates a COM port. Windows recognizes this class and loads the apropriate driver which is usbser.sys (https://msdn.microsoft.com/de-de/library/windows/hardware/dn707976%28v=vs.85%29.aspx) when the driver is loaded the new (virtual) COM port is accessible
the best sources are How does windows map the virtual com port to a device, https://superuser.com/questions/851192/change-com-port-number-programmatically and http://www.ftdichip.com/Support/Documents/AppNotes/AN_132_Re-Assigning_COM_Port_Numbers_Using_Registry.pdf
I would suggest using libusbp, a C library that can be used to find the name of a COM port, given the USB vendor ID and product ID. There is even an example in the "examples" folder that does just that:
https://github.com/pololu/libusbp

Autoconfiguration on programmable Xbee modules

Non-programmable Xbee modules should be configured through a PC (with XCTU) or other devices like Arduino... but can the programmable xbee modules (like xbee-pro zb s2b) autoconfigure themselves, without being connected to another device like a PC or Arduino, by running code stored in their memory?
I mean, can they run orders like the ones you run through XCTU but programming them in the internal memory code? Like scan energy of every channel, select a channel, set a PAN ID, configure the different parameters of the device...
Thank you
Yes, the development kit includes an API for sending AT commands from the co-processor to the radio on those boards.
There's also a passthrough mode that relays the host computer serial port through to the radio processor, which can help with initial setup/configuration of the modules like you might do during manufacturing.
To answer your question:
I mean, can they run orders like the ones you run through XCTU but programming them in the internal memory code?
No. You can not program a sequence of orders/commands into the internal memory of the device. To do anything meaningful the device needs to be "driven" from a host PC or MCU that can send the AT Commands.
If you want 1 device solution that does not require a Host MCU then you will need to use a ZigBee SoC (System on Chip), such as the CC2538 - http://www.ti.com/product/cc2538 running a ZgBee SDK (Software Development Kit) - http://www.ti.com/tool/z-stack (ZStack-Home). However this will require you to develop the ZigBee application SW.
Regards,
TC.

How to write a simple usb driver for a hardware copyright protection dongle?

I want to create a USB driver, so my own C application to be able to get into my flash drive and take information from the imported flash drive.
OS: Windows
I start my app contains my USB driver and I plug-in my flash and its shows in Explorer that this drive is plugged and it is accessible, while that's happening, my app is checking that file data.txt EXIST if that file exist, program run next function, if not program, my program runs down/exit/!
If you are looking for a programmable USB dongle, I suggest inspecting this SO thread: Programmable USB dongles
The Windows Driver Kit should simplify your work or atleast help you at the start.

Resources