How to use Visual Basic, Mindstorms NXT and USB communication Altogether? - usb

I have been researching for a couple of days, and i have not found anything I understand about sending direct commands to the NXT via USB. All of the tutorials I have found are based on Bluetooth communication, and the information I have found about USB is always like "Better change to bluetooth", or "Think about it as a COM port"
I had previously sent those commands via Bluetooth, but the connection fails too often to be useful, and is slower than USB.
USB connection is not detected as a COM port, but I know it is posible to control motors and get sensor input with a USB connection, because the LEGO software does so. It has that remote control feature that allows user to activate motors from the PC, and can read sensor input as well.
So, my question is, How can I send and recieve those direct commands via USB? and, Is there any way to do so in Visual Basic 2008?

You can use the MonoBrick Communication Library to do this. See http://www.monobrick.dk/software/monobrick/.
Alternately, you could use the Fantom driver from the official LEGO Software developer kit. http://www.lego.com/en-us/mindstorms/downloads/software/nxt-sdk/

Related

how to generate HID get/set report requests to test a new usb device

I want to test my usb device firmware. I'm looking for a host tool to generate get/set reports to exercise my USB device. Handling INPUT requests and generating OUTPUT requests would be a bonus.
Are there any generic tools to send a USB message? Any python tools to recommend?
It seems like a pretty generic need but I havent found much in my web searches.

Is it possible program STM32 device wireless?

I have an STM32-discovery board and I am trying to program it with not using any cables.In the place where I am doing my internship, they first wanted me to program STM32-discovery with UART. I was able to do this by making the necessary connections and using the Flash loader demo. Now my next task is to add an ESP-07 wifi module on the STM32-discovery board, connect this module to the same network as my computer, and wirelessly program it from my computer. No other device is wanted in between (like Raspberry). I did some research on this topic but couldn't come to a conclusion. What I found; I can remote program by connecting the card to a Raspberry or a device called Codegrip. Is it possible to do this with only an ESP-07 without these devices? I will be glad if you just tell me what should I look for.
Yes, it's possible to reprogram the STM32 flash wirelessly if the STM32 is running a program that supports this capability. When you programmed the STM32 via the UART there was a program running on the STM32 that:
opened the UART port,
received the new program data via the UART (using some protocol),
and then programmed that new data onto the flash.
To do likewise wirelessly, the STM32 will need to be running a program that:
opens the Wi-Fi port,
receives the new program data via Wi-Fi (using some protocol),
and then programs that new data onto the flash.
You may have used the STM32 internal ROM bootloader to reprogram via the UART. And if so then you used the protocol required by that ROM bootloader. But the ROM bootloader probably does not support Wi-Fi. So you'll probably be creating your own bootloader program that can communicate over Wi-Fi. And you might be defining your own protocol for transferring the program data over Wi-Fi. Or maybe you can apply some established protocol such as FTP. Search for examples of bootloaders that support OTA (over the air) firmware updates.
There are two possible solutions.
Write a custom bootloader for the STM32 - the flash is organised with smaller blocks at the start to support that, so you would move your application to higher memory and have the bootloader either jump to the application to load a new application. The bootloader can then access the Wi-Fi module (and other interfaces) to get updates.
Write custom firmware for the ESP0-07 so that it receives and stores the STM32 image, then transfers it to the STM32 using the existing ROM serial bootloader. In this case you need the details of the bootloader protocol, and it would be useful if the ESP-07 had a GPIO connection to the STM32 reset line so that it can invoke the bootloader without a manual reset.
Either way, you need to write software for one or other of the devices.
You can use any standard bootloader and connect the Wireless module like ESP32 (Bluetooth and Wifi), ESP8266 (Bluetooth and Wifi), BT-05 (Bluetooth), HM-10 (Bluetooth), etc.
Then create the android application or web application and update the Firmware or application.
If you don't want to use the Standard Bootloader, you can implement your own bootloader and add this OTA feature to that.
We have added the Tutorials step by step. Please refer to this if you get time. There we have developed the custom bootloader and updated the Firmware.

WWAN Interface AT Commands

I've got a Windows 8 Professional device which has got a Mobile Broadband adapter embedded and I need to be able to send AT commands to the modem, usually I'd connect to the COM port and send the commands. However the device doesn't appear to have any COM ports, instead it presents its self as a network adapter.
I'm wanting to send AT commands to change the APN of the modem and to reset the device, I've looked into the 'netsh mbn add profile' but this command always returns an error advising that the XML profile is incorrect.
Also from looking at the functions of the netsh mbn it doesn't seem to provide as much control as sending AT commands.
The modem that I'm trying to interface to is the Ericsson C5621 GW on a Lenovo ThinkPad Tablet 2.
Is there another way to send AT commands?
Thanks
I do not know this product in particular, but since I worked in Ericsson, later in ST-Ericsson with mobile phone development for over a decade it is doomed to have some of my code in it so I'll answer on a general basis.
Short version is, no unless the device exposes a serial interface over one of the external interfaces (possible interface types are RS-232, IrDA, Bluetooth, USB or CAIF), there is no way of sending AT commands to it1.
Being an embedded device in a laptop and
your since you say it seems to be without serial interfaces I assume it uses CAIF (commonly used in embedded settings. It could also have be using USB with the serial interfaces disabled, but since this press release mentions that it will be available in a version with PCI interface, that is very unlikely). And thus unless the device is set up with any active VEI channels, there is no ways in for AT commands.
There might be other ways of changing the APN though.
1 We had a debug mechanism to inject AT commands onto arbitrary serial interfaces, but this itself was running on a serial interface, started by an AT command. And besides it will not be present in released products.

Is it possible to determine usb protocol from an installed driver?

Just as the question states, the goal is to reverse engineer the protocol used by a device.
Let's say you have a webcam, an Arduino and an Arduino USB Host shield. You want to talk to that webcam, from which you don't know the protocol. Can it be done by monitoring USB data packets and by analyzing the driver installed for that device?
It would be a really interesting project.
Thanks in advance.
I often use a serial spy program to look at the conversation between two devices. In windows you can pay for it...
http://www.sinnovations.com/htdocs/serial-port-monitor.htm
In Linux it's free...
http://www.cyberciti.biz/faq/howto-monitor-data-on-a-serial-port-in-linux/

making a usb device from scratch... what are the pros of a VCP driver?

I'm building a thingy that will have a usb interface, I'm pretty keen on the FT232RL for this purpose. The manufacturers offer virtual com port drivers for linux and windows. I haven't really done this sort of thing before so I was wondering if anybody can tell me why one might want to use a VCP driver or point me in the direction of some resources on the topic. I'm assuming it's just for the sake of simplifying the process of writing a driver but i'm really not certain right now.
In this case, VCP stands for "Virtual COM Port". If you use the drivers from FTDI, they will create a virtual COM port on your computer when you plug in the device. Nearly every language has a library for sending and receiving bytes on COM ports (e.g. System.IO.Ports.SerialPort), so your device will be usable from all of those languages. You will not have to write a driver.