USB port as input to MOJO

General discussion about the Mojo
Post Reply
User avatar
morseworld
Posts: 9
Joined: March 30th, 2013, 1:27 pm

USB port as input to MOJO

Post by morseworld » April 25th, 2013, 1:44 pm

I'm looking for an example of having a program running on my PC to communicate to the MOJO over the USB port to say, have the LEDs light up based on the commands sent from the PC to the MOJO. This would give ma a way to communicate to the MOJO and then the MOJO could communicate via I2C/SPI to other devices.

leictreonaic
Posts: 23
Joined: April 24th, 2013, 12:17 am

Re: USB port as input to MOJO

Post by leictreonaic » April 25th, 2013, 7:25 pm

I found this, <http://embeddedmicro.com/tutorials/the- ... -interface> and thought of your post.

It says you can communicate over the usb port after FPGA configuration.

Part of a class project I worked on was to send an RFID tag number from an Arduino BT to the computer using bluetooth. Had to configure the serial data pins on arduino then we had a visual basic program on the pc that read the COM port and stuck the number into a file. This was almost 4 years ago now so I don't remember the fine tunings of what we did.

I found something that we used to send a start command to an Arduino Nano controlled little forklift. here----> http://csharp.simpleserial.com/ Not sure if you could use it for what your wanting to do. Looks like it would do the same simple thing with the Mojo after all they both use the atmega chips for it. Hope any of this helps.

User avatar
morseworld
Posts: 9
Joined: March 30th, 2013, 1:27 pm

Re: USB port as input to MOJO

Post by morseworld » April 26th, 2013, 11:51 am

I see the pieces but it would be nice to see a complete project base on the MOJO and a PC.
(1) The PC would send a command to the MOJO to turn LED1 - LED8 on or off and the MOJO could send back an acknowledgment.
(2) The PC would send a request for the reset button status and the MOJO would send back the status.

leictreonaic
Posts: 23
Joined: April 24th, 2013, 12:17 am

Re: USB port as input to MOJO

Post by leictreonaic » June 14th, 2013, 9:10 pm

Okay morseworld I found your idea interesting to get me started. I have been working on a visual basic app to play with the leds on the Mojo. This is what I have so far. It sets the leds on the Mojo just fine and when you type characters you can see their binary ascii value on the leds. You can select an 8 bit value from drop down list and transfer to leds. The Mojo echos back and shows what was sent as decimal value. You can also toggle each led individually with lower buttons. The picture boxes under the leds I could not figure out how to get them to follow the leds. Or rather be set by the returning echo byte.

With help from the tutorials, Xark and various other references for verilog and VB Here is where its at. I am not sure how to handle an IO Exception in the windows app that causes an error when closing. But just choose to close the program if it happens. If anyone has experience with VB and can spruce this up it would be appreciated. If you want I can share the vb project but I'm not sure should I just post the entire project folder or just the main files such as form and form [design]. Anyway,

The windows app and Mojo project are here:

https://drive.google.com/folderview?id= ... sp=sharing

Update!! I just needed some more sleep. I got it working with exception of the IOException. I put the new app in th folder at same location. Everything in app works as planned. Picture boxes light up from Mojo echo byte and can toggle along with Mojo leds.

embmicro
Site Admin
Posts: 834
Joined: March 24th, 2013, 12:45 pm

Re: USB port as input to MOJO

Post by embmicro » June 17th, 2013, 3:50 pm

We do have a tutorial that covers sending and receiving data on the serial port. If you haven't checked it out you can find it here. http://embeddedmicro.com/tutorials/mojo/hello-world/

gordo
Posts: 3
Joined: January 19th, 2017, 1:30 pm

Re: USB port as input to MOJO

Post by gordo » February 10th, 2017, 6:50 pm

Somewhat related...

Can the mojo be used to source a USB device? I'm looking at connecting in input device such as a keyboard/mouse/joystick. If so, I assume it would need to be a) connected to external power supply and b) connected to the device via a plug to receptacle.

Thanks.

Edit - alternative I suppose, would it be possible to attach a USB-PS2 converter to a keyboard and connect it to the mojo that way?

embmicro
Site Admin
Posts: 834
Joined: March 24th, 2013, 12:45 pm

Re: USB port as input to MOJO

Post by embmicro » February 13th, 2017, 11:59 am

The USB port on the Mojo is a slave only USB port and can't host other peripherals. You could always get a microcontroller that supports USB OTG or simply is a host and connect to the Mojo.

Post Reply