Arduino Firmware Recommendation Needed - usb

I have an Arduino-compatible ADK board with USB Host Shield.
(Specifically, it is the Seeeduino ADK Main Board at:
http://www.seeedstudio.com/depot/seeeduino-adk-main-board-p-846.html. It is receiving external USB Power.)
I have a custom USB accessory connected to it, and I need to do something that should be simple for this forum's contributors.
My ultimate plan is to connect an Android 3.2 tablet or phone to the ADK board and tell it to send out a hex packet to my USB accessory. But right now, I need sample code for the Arduino firmware to send hex commands out to my USB accessory.
The packet breakdown is as follows:
STX DAT1 DAT2 DAT3 DAT4 ETX CHK
Name Hex Definition
STX 02h Start of Text Data
DATx --h Text Data
ETX 03h End of Text Data
CHK --h Checksum
Can someone point me to example firmware for my Arduino board to output this data packet to my attached USB Accessory?

Closest thing I could find was the Arduino Serial Reference at:
http://arduino.cc/en/Reference/Serial
Any other responses would be appreciated.

Have you tried the standard Google ADK example?
http://developer.android.com/guide/topics/usb/adk.html
From what I can see on the Seeeduino page you shouldn't have to do anything special. Once that's up and running you can modify the code to work with your message format.

Related

STM32 F407 Discovery Joystick Thrustmaster T-Flight Hotas X

I am trying to use the Thrustmaster T-Flight Hotas X joystick with my STM32 f407 Discovery board. As you know, the joystick has a USB connection, but actually I do not know how it transmits data and I do not know what kind of protocol it uses...do you have any advice?
Is there a way to connect the joystick to the board?
Yes, you can use the USB OTG port in host mode to connect your joystick.
The joystick will use USB HID protocol - this is documented in detail at usb.org. Short version: The device tells you in its "report descriptor" how the data is formatted. The data itself is transmitted via interrupt endpoint.
Unfortunately, the software side is non-trivial, as you need host mode on the MCU. Parsing the report descriptor is not required if you only ever use the same joystick model - which can be identified using the VID:PID in the device descriptor.
There should be an appnote with some example code for USB host mode on the STM website, but in order to support your joystick you probably have to make some modifications - which are rather difficult for beginners.

SAM4E16C MAC and PHY(ksz8081mnx) initialization

Hello to everyone I have a problem which is initializing the MAC and PHY(ksz8081mnx) on SAM4E16c. The main goal is to see if I can get information from the ethernet but unfortunately, I do not know how to read the data from the ethernet. I am new in this I hope someone can give me some tips to follow.
The tools that I am using are Atmel Studio IDE and Atmel ICE programming tool. The project I created is with Atmel Software Framework (ASF). I installed all drivers needed for the MAC and PHY (ksz8081mnx). I followed the "Quickstart guide for GMAC driver" which is on this website:
http://asf.atmel.com/docs/3.35.1/sam4e/html/gmac_quickstart.html
I uploaded the sketch and I tested it by looking at the router's client list if I can see the MAC address but I did not. I not sure if this is the right way of doing it but I had to try.
I not sure if I initialized the board as it should be. I took the board_init example from (sam4e16e xplained pro ASF).
These GMAC peripheral registers are in the SAM4E16C.H file and they are corresponding with the (ksz8081mnx) chip but there are not used anywhere.
Should I set them in the board_init somehow or should I leave it like it is shown in the first picture?
PIO definition for GMAC peripheral
These pictures are showing the Ethernet chip connection to the processor:
Schematics Ethernet
Schematics µC
Thank you, I am looking forward to your suggestions.
:)
1st of all read the all ENET gmac controller register, you are able to access these controller register or not.
ENET_BASE_ADDR - Base address of gmac controller.
ex val = readl(ENET_BASE_ADDR + offset);
Configure the registers which are responsible in ENET operation.
eg: Network control, network config register, PHY management register, Transmit status register, Receive status register,Tx Queue pointer, Rx Queue pointer.
Most important register where we need to configure the 6 byte MAC address.
#define ETHERNET_CONF_ETHADDR0 0x00
#define ETHERNET_CONF_ETHADDR1 0x04
#define ETHERNET_CONF_ETHADDR2 0x25
#define ETHERNET_CONF_ETHADDR3 0x1C
#define ETHERNET_CONF_ETHADDR4 0xA0
#define ETHERNET_CONF_ETHADDR5 0x026
After configure the MAC address into those register, then memory dumped those register to confirm that MAC address is properly configured or not.
prepare DMA tx and rx ring buffer descriptor. I will explain more in detail if you provide the complete gmac data sheet.
To access the PHY register, we need to configure the ENET GMAC phy management register properly.
Please provide the complete gmac and its PHY data sheet. I will answer more on phy and its operation.

How to get audio from GSM modem - Not to a speaker but as a RTP stream

I have a GSM modem with a serial port and soldered points for MIC and Speaker. Through the serial port I can send AT signalling commands, send SMS and make/receive calls. I had to solder a speaker and a MIC to the modem card. My problem is that I want to read the audio stream as a RTP stream, possibly through some intermediate hardware/software. My goal is to ultimately get the audio as a RTP stream on some port with some RTP profile. I understand that I need to run a UDP server to serve the audio over a UDP IP-address/port tuple, but how do I get the audio to the UDP server in the first place? Codec conversion is also something that I am familiar with and am aware that I may need it.
This is a simplified diagram of what I intend to do:
GSM-modem-audio ---*1*---> audio-over UDP(ip-address:port)---->
>---*2*--> Kurento RTPendpoint---*3*--->Kurento-WebRTC endpoint
I don't know how to handle part * 1 * piece of the puzzle.
Easy way: get Rassbery-PI, get usb sound card, connect analog output of modem to sound card.
Have be no problem convert digital ALSA sound card signal to rtp stream.
More complex way - create special hardware which will do same.. oh wait! That will be like sangoma board.
Anyway it is not wise idea create something like that yourself except for educational purpose, becuase it will be costly or low quality.

XBee S1 read values from API mode

I have two XBees S1-one attached to a temperature sensor. This Xbee reads analog values, converts them into digital values thanks to the ADC and transmits them.
The other XBee - the receiver, is connected to a computer via a USB Explorer.
This XBee works in API mode. The XBee connected to a computer receives the data send by the transmitter. I monitor the received values with the X-CTU software, version 6.2.0. Up until this point, everything works fine.
However, the problem that I encounter is that the data received on the computer is coded: there are bits corresponding to the address of the receiver, bits corresponding to the address of the sender, the data itself, acknowledgment bits,etc. My question is how can I extract only the data bits without all th other information send by the transmitter?
I tried to read the values with a USB to TTL cable, connecting this cable to the Tx, Rx,GND and 5V(there is a 5V input in the USB Explorer despite that the XBee works at 3.3V) of the receiver XBee and using the screen command in Linux. However, in this way I receive ASCII characters and I want to receive the binary code.
I want to put those values in a database in order to be able to treat them later.
Thank you for your assistance.
With a library like this one, you can use function to get the data from your Xbee in python ;) (if you use linux)
You just have to initialise the port (should be on /dev/tty...) and than catch the data with a loop which check if new data is coming.
If you need more help I can send you part of my code (doesn't have it near me, it's on my raspy)
I hope I've help you ;)
Thana

MSP430 SPI to M25P64

I have a SPI for MSP430 written. If I send WRSR(01h) or RDSR(05h) to M25P64 flash.
The response I get from the Flash SPI_MISO is FFh.
So my question is "Is the response I have obtained is it right?"
How do I come to an understanding that handshaking between my SPI and Flash is correct?
Thanks
AK
Is the response I have obtained is it right?
The response is wrong. 30 seconds on Google and in the datasheet will tell you that. Things to check (since you have not provided any information):
How do I come to an understanding that handshaking between my SPI and Flash is correct?
Is this a new piece of SPI code? If so have you checked with an oscilloscope to see what you send out (clock and MOSI) is what you expect and matches what the datasheet says the device expects? It's the definitive way to be sure.
Does your SPI code work with any other devices?
Are your IO pins configured correctly on the MSP430?
Have you got the SPI module configured correctly for phase and polarity?
Did you forget to assert the chip select line?
What about HOLD?
Did you remember to send a dummy byte after the RDSR command so that the device would send the status register value?
Do you see a response from the device on an oscilloscope? Does the MSP430 read that value or a different one?
You are sometimes better first of all trying to read the device ID rather than the status register for a new piece of code. The reason for that is the device ID will never change, whereas the status register might change (although that depends on the device).