How can I read SPI (Serial Peripheral Interface) data sent by a microcontroller on Windows - spi

I'm working with an Atmel ATMEGA328P microprocessor that is writing debug information out the MOSI SPI pin. Is there a way to wire a connection to a Windows computer so I can see the debug information?
Ideally, there would be a breakout board or something that can be purchased that would allow me to run wires from the microcontroller's SPI ports to the board and then the board would have a USB connection so I can connect to my computer. I've searched and nothing is coming up, but maybe I'm not using the right terms.
If a connection is possible, any references to code or an existing program for reading this data would really help.
By the way, the USART pins are already being used by the microcontroller for communicating with another device, otherwise I would've used them with a FT232R breakout board.

You need an SPI adapter. SparkFun has a cheap one for sale. If you have an Arduino or another Atmega328 lying around you can set it up as SPI host and use it as a SPI-USB adapter.

Related

STM32F767zIT6 to PC communication via a USB cable

I need to connect a custom board having STM32F767zIT6 as the MCU to a window PC through a USB. The aim of the board is to filter CAN-BUS messages. The existing solution uses a CANBUS-USB adapter through one of the CAN interfaces but I have been asked to implement the USB functionality on the board since it has a USB2.0 mini-B port. I need to receive CAN messages through one of the CAN interfaces and transmit it through the USB interface to a GUI on the PC and also receive CAN formatted messages from the GUI via the USB to another CAN interface on the board. I have been playing around with the HAL_library for STM32 using STM32CubeMX but I need guidance and materials I can learn faster. If possible a similar open source implementation I can learn from.

Data input/output on Basys3 board's USB port

I'm trying to configure/write VHDL code that would let me output or input data from the USB port on a Basys3 FPGA board. Problem is I have yet to found any threads or questions that talk about this topic.
The nearest thing to an answer I've found is this:
Provide input data to FPGA using USB
and it does not contain what I'm looking for.
Any clues anyone¿?
The Basys3 board has a usb-uart bridge chip as described in the reference manual. This will appear to a PC (or any device with a usb host and the appropriate usb-serial drivers) as a virtual com port. Sending data to and from a PC com port is quite easy.
You will need a uart implementation on the FPGA. There are lots of example designs on the web. One way is to implement a soft core microblaze processor with a uart peripheral in the FPGA. This example looks like it includes foundation for the functionality you desire.
The simplest implementation from the PC side is using a terminal program such as putty, Tera Term or realterm. Most languages include com(serial) port libraries or bindings. This type of interface tops out at a raw bandwidth of around 3-12Mbits per second depending on the drivers and implementation.
Read the manual for the Basys 3 board. It will explain how you can interface with USB devices plugged into the USB port. Be warned, however, that your options are pretty limited.
Short version: if you plug in a USB mouse or keyboard, they will be exposed to your design as an emulated PS/2 device. USB storage devices can be used to configure the FPGA. Other devices are not supported.

Provide input data to FPGA using USB

I am working on Xilinx Spartan 3E platform, using this development board:
http://www.xilinx.com/products/boards-and-kits/HW-SPAR3E-SK-US-G.htm
My program operates on certain data and then provides output. I wish to transfer the input signals externally. The input data is a stream of 8-bit signals.
So, how do I send the input signals from my laptop to the FPGA via USB? Does Xilinx support this or is there standard software to do this?
Thanks.
It sounds like you are describing a uart more than a native USB interface. You can get a USB to logic level serial adapter that will let you easily transfer data to and from a Pc at up to 921.6k baud. A uart/serial port is easy to implement in the Fpga and PCs are easy to use with serial ports.
Here is the cable:
http://www.ftdichip.com/Products/Cables/USBTTLSerial.htm
If you have a development card it is very possible this type of interface is present.
On the software side you can use your programming language of choice as if it was interfacing with a seal port or use a terminal program like hyper terminal or Download teraterm http://ttssh2.sourceforge.jp/
Updated response:
100Hz is not a hard interface to make. At that rate you should use the serial interface if at all possible. The board you referenced has 2 full RS-232 connections. At that point you only need a way to connect that to your computer. If you have a PC with RS-232 connectors you only need a cable if you have a newer computer without you need a RS-232 to USB translator cable (like this one: http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=768-1014-ND or google rs232 usb). This will give you a virtual com port on the pc to interface with the previously mentioned terminal programs or your custom software.
Update 2:
on the resource tab of the development board page you linked to there are several UART based fpga designs that you should be able to use as a starting point.
i.e. the "PicoBlaze Processor SPI Flash Programmer".
That board doesn't provide easy access to the USB interface from the FPGA as far as I can tell. It's just for configuration and debug.
Some of the newer boards and tools do allow something called hardware-in-the-loop testing where the simulator can upload data to the FPGA, wait it to calculate the results and then pull the data back. This is relatively common when using Xilinx's System Generator product as the simulations can be really long.
But I think with that board you'd be better off using the on board RS232 port to get data to and from the board. You will have to build the infrastructure to do it yourself though.
This may also give you some ideas:
http://www.1pin-interface.com/

Korg Nanokey MIDI Controller for Arduino?

I have a Korg NanoKey which I'd like to use to control a simple synthesizer I've designed on the Arduino platform. (I have an Arduino Uno.) Basically, I don't care about MIDI, I just want to read what note the keyboard has pressed down, but if MIDI is the only way I can do that, then it's okay with me. So my big question is, how do I do this? I haven't been able to find anyone else on the Internet who has already done this.
But more specifically, I see two challenges: First, I'd like to plug my NanoKey directly into the Arduino's USB port, but then I'm wondering if the Arduino would provide the necessary power to the NanoKey. Second, I'm not sure what protocol I would be reading. Can I just read MIDI signals as described in this tutorial?
I don't want to curb your enthusiasm but what you're attempting might be a bit hard basket. A USB system consists of a host controller and one or more peripheral devices. It's the host that controls traffic flow to the devices which means that devices can't transmit data on the bus without an explicit request from the host controller.
I'm not familiar with either the nanoKey or the Arduino platform but I'd be fairly confident that the nanoKey is a USB "device", normally connected to a computer which would act as the host. So what you would need for this system to work is for the Arduino to act as the host when communicating with the nanoKey. The Arduino schematic shows that the Arduino Uno uses an ATmega8U2 for USB coms. Unfortunately the ATmega8U2 is a USB device, so you've got two peripheral devices but no host controller to facilitate the transfer of data between them. You'd be better off using a development board for a micro that provides either USB Host or USB On-the-Go.
I opened up a Korg Nano controller yesterday and was surprised to discover that there's an AVR mega32 inside. It would be a significant undertaking, but with a bit of work you could probably work out the schematic and reprogram it yourself using their programming header breakout. You might not end up with much more functionality than you've got this other way, but it would be very educational.
I agree with the Jono - you are biting off a lot - it might even end up easiest to hook the keys up to the Arduino directly - tearing out the electronics and figuring out a way to multiplex the keys into a single channel without losing polyphony (resistor 'ladder' maybe). I any case, good luck. Amusingly, you'd making an analog keyboard to plug into a digital synthesizer.
Quick and Dirty Arduino MIDI Over USB demonstrates how to send/receive MIDI out over USB, but unfortunately, this probably isn't any help for what you are trying to do, since he's found a way to send and receive MIDI signals from a USB host, not act as a USB host himself - the opposite of your problem. However, I thought perhaps it would be of use, if you ever wanted to control your device from a computer.
As mentioned in the other posts, you would need to use a separate chip to provide the USB Host interface. Here's a great guide to using the USB Host shield by Circuits#Home to interface with an Akai LPK25 (USB Midi Keyboard).
http://blog.makezine.com/2010/11/30/usbhacking/
The Arduino sketch is provided, so you should be able to try it out, however debugging the USB Host connection could get tricky real fast if it doesn't work out of the box.

Wireless programming with the Arduino XBee Shield and XBee Explorer

I am trying to enable wireless programming of an Arduino via the XBee Shield and an XBee Explorer. I've seen two tutorials online, XBee radios and Wireless Bootloading for ATmega168/ATmega328 that show you how do it.
However, both tutorials talk about using components to connect the receiver XBee to the Arduino. Well the XBee Shield handles the communication between the receiver XBee and the Arduino, so the extra components aren't necessary (or are they). They talk about using a capacitor or transistor to be able to wirelessly reset the Arduino. Is this already possible with the XBee Shield, or is there some modification I can make to it to make it possible?
How can I use the existing Arduino IDE to program my Arduino wirelessly?
You are correct in the fact that the extra components are needed to reset the Arduino wirelessly and you do need them even if you are using the Xbee shield. I'll assume that one of the tutorials that you were reading was this one. What you are going to want to do is read over the tutorial and build the transistor/capacitor/resistor circuit into a little ball (similar to this) or on a piece of prototyping board with the three signal wires coming out. You need to solder the "Reset signal from XBee" to the D3 pin on the shield which should be labeled (or it can be found on the Datasheet). Then you will have to figure out a way to connect the reset to the reset pin on your Arduino, and the ground to either device (because they should be connected by the shield). This can be as simple as sticking the wire into the sockets on the Arduino. After you do this and setup the environment as per the previously mentioned tutorial, you should be good to go!
If you do have any questions, feel free to ask, I should be able to help.