Jump to content
M-atthias

Bit-Bang USB on MSP430G2452

Recommended Posts

@@Felix24

 

Not use what would be the right value for the delay. The delay is for allowing the power supply to settle / become stable. The host side upon detecting the device will send set-up packets and there are some requirements on how quick the device side need to respond. This may be the source of the problem.

 

How long the delay should be? In my experience is really based on the h/w set-up, I recall needing different delays for LDO regulator and zener diode set-up. If you have a scope you can find out more what happens during power applied.

Share this post


Link to post
Share on other sites

Thanks to this post (http://forum.43oh.com/topic/3220-options-for-usb-keyboard-emulator-ics/?p=27807), I was able to code a working HID keyboard.  I successfully ported the keyboard scanning code from the Arduino Leonardo into my hid430 project (using some of the Leonardo HID library functions in the process), and was able to scan all the keys and and send reports properly.
 
However, implementing the keyboard status LEDs didn't work as planned, because when I modified the HID descriptor to receive LED data, the keyboard would glitch out and crash a fraction of the time when it received an LED message.  Through troubleshooting, I found that progressively disabling the key scanning algorithm caused the problem to clear up, but at the expense of scanning the keyboard.  Maybe there's an interrupt thrown when the chip receives an LED message, and if it happens while inside a scanning loop, it can't properly recover.

 

Since I set out to create a keyboard with LEDs, I took a different route and programmed two g2553's, one that scans the keys and one that handles the USB and the status LEDs.

 

The scanning chip transmits the necessary key bytes to the USB chip.  I did it in parallel because I had a whole gpio port free on both chips.

 

post-38267-0-83528000-1412091351_thumb.jpg

 

The small board on the right handles the USB, while the big board on the left handles the keyboard scanning. I connected the piezo speakers to output pins that are toggled during operation, so I can hear when things are working and when they are not (I don't own a logic analyzer, and my analog oscilloscope is on the other side of the room).  Scanning is accomplished with one 74HC595 output shift register connected to the 8 "row" pins on the keyboard, and two 74HC165 input shift registers connected to the 16 "column" pins. A single row is powered with the 595 and the columns are read out of the 165 shift registers.  Pressing a key will flip one bit in the output stream; pressing multiple keys will flip more bits with no overlap.  There are 8 rows and 16 columns, with each full scan producing 32 bytes.  The ribbon connector is out of a different laptop, soldered to a homebrew pcb.

Share this post


Link to post
Share on other sites

[update] Now it works with cycwin plus mspgcc from sf.net.

@simpleavr,

Could you help let me know the toolchain info for the project?

I am using CCSv6.1 plus msp430gcc_3.4.5.1 and downloading hex files using FET430 pro lite.

It is OK if I download your hid hex directly. So it indicates that h/w wiring is OK, however the mouse can not be recognized if I compile the source files to .out file then download it using CCS.

Edited by RiverLiu

Share this post


Link to post
Share on other sites

[update] Now it works with cycwin plus mspgcc from sf.net.

@simpleavr,

Could you help let me know the toolchain info for the project?

I am using CCSv6.1 plus msp430gcc_3.4.5.1 and downloading hex files using FET430 pro lite.

It is OK if I download your hid hex directly. So it indicates that h/w wiring is OK, however the mouse can not be recognized if I compile the source files to .out file then download it using CCS.

@@RiverLiu, Sorry for the late reply. I am not very active in the forums this year. Glad you are able to get it going. I mostly use cygwin + mspgcc for this project, also ubuntu linux. For CCS I understand someone had it working (may be V5). If you are starting from my github repository, it is best to go cygwin + mspgcc route.

Share this post


Link to post
Share on other sites

I don't know whether others encounter such problem, but my msp430 usb mouse can not be recognized if I plug it in a pc with a mouse already pluggined in. 

I have tried several PCs and mice to have this conclusion. I will try to see whether the problem is with V-USB with avr mcu.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×