Upload problems...

chrisjx
Posts: 1
Joined: Thu Jun 23, 2011 10:09 pm

Upload problems...

Post by chrisjx »

When trying to upload to the FHB I get the following error:

FreeduinoHostBoardDemo01.cpp:31:22: error: Max3421e.h: No such file or directory
FreeduinoHostBoardDemo01.cpp:32:17: error: Usb.h: No such file or directory
FreeduinoHostBoardDemo01.cpp:33:30: error: AndroidAccessory.h: No such file or directory
FreeduinoHostBoardDemo01:89: error: 'AndroidAccessory' does not name a type
FreeduinoHostBoardDemo01.cpp: In function 'void setup()':
FreeduinoHostBoardDemo01:202: error: 'acc' was not declared in this scope
FreeduinoHostBoardDemo01.cpp: In function 'void loop()':
FreeduinoHostBoardDemo01:217: error: 'acc' was not declared in this scope

I've tried all manner of locations for the example code and the android accessory libraries. Any tips?

Using Arduino-0022 in Windows.

TIA,
Chris.

oz
Site Admin
Posts: 542
Joined: Mon May 12, 2008 4:19 pm

Re: Upload problems...

Post by oz »

chrisjx,

See the instructions here:
http://wiki.moderndevice.com/pmwiki.php?n=MD.FHB

You could be forgiven for not finding - they just went live last night.
I'm interested if anyone has additions and clarifications to the instructions, by the way, they're still preliminary.

The main points of the instuctions are:
• Download my Arduino libraries and install
* Choose Arduino Uno in the Tools->Boards menu
• Run the demo in the Freeduino_USB_Host_Board library
* Install Google ADK demo kit on the phone (but not the AndroidAccessory library in Arduino)
* Plug in the phone

The long form instructions are on the wiki

Paul

terrycarlin
Posts: 3
Joined: Fri Jun 24, 2011 2:19 pm

Re: Upload problems...

Post by terrycarlin »

I followed the instructions on the site above but when I tried to compile the sketch, I got these compile errors. BTW, I am on a MacBook Pro.
I set the Board to Arduino Uno. Interesting that if I set the board to Mega2560 I get no compile errors, but timeout on the upload.
Compile errors when Board set to Arduino Uno:

/Applications/Arduino.app/Contents/Resources/Java/libraries/USB_Host_Shield/Max3421e.cpp: In static member function 'static void MAX3421E::setRST(uint8_t)':
/Applications/Arduino.app/Contents/Resources/Java/libraries/USB_Host_Shield/Max3421e.cpp:58: error: 'PORTJ' was not declared in this scope
/Applications/Arduino.app/Contents/Resources/Java/libraries/USB_Host_Shield/Max3421e.cpp:58: error: 'PJ2' was not declared in this scope
/Applications/Arduino.app/Contents/Resources/Java/libraries/USB_Host_Shield/Max3421e.cpp:60: error: 'PORTJ' was not declared in this scope
/Applications/Arduino.app/Contents/Resources/Java/libraries/USB_Host_Shield/Max3421e.cpp:60: error: 'PJ2' was not declared in this scope
/Applications/Arduino.app/Contents/Resources/Java/libraries/USB_Host_Shield/Max3421e.cpp: In static member function 'static uint8_t MAX3421E::readINT()':
/Applications/Arduino.app/Contents/Resources/Java/libraries/USB_Host_Shield/Max3421e.cpp:65: error: 'PINE' was not declared in this scope
/Applications/Arduino.app/Contents/Resources/Java/libraries/USB_Host_Shield/Max3421e.cpp:65: error: 'PE6' was not declared in this scope
/Applications/Arduino.app/Contents/Resources/Java/libraries/USB_Host_Shield/Max3421e.cpp: In static member function 'static void MAX3421E::pinInit()':
/Applications/Arduino.app/Contents/Resources/Java/libraries/USB_Host_Shield/Max3421e.cpp:77: error: 'DDRE' was not declared in this scope
/Applications/Arduino.app/Contents/Resources/Java/libraries/USB_Host_Shield/Max3421e.cpp:77: error: 'PE6' was not declared in this scope
/Applications/Arduino.app/Contents/Resources/Java/libraries/USB_Host_Shield/Max3421e.cpp:78: error: 'DDRJ' was not declared in this scope
/Applications/Arduino.app/Contents/Resources/Java/libraries/USB_Host_Shield/Max3421e.cpp:78: error: 'PJ2' was not declared in this scope

terrycarlin
Posts: 3
Joined: Fri Jun 24, 2011 2:19 pm

Re: Upload problems...

Post by terrycarlin »

I figured out this one. I had installed the USB_Host libraries from somewhere else. I removed those libraries and went back to a clean Arduino install.
I put the AndroidAccessory and Freeduino_USB_Host_Board folders in /Applications/Arduino.app/Contents/Resources/Java/libraries/ (I am on an OS-X MacBook Pro)
Then in the Arduino app I set the Board type to be Arduino Uno. On my Mac, the Freeduino USB Host Board showed up as /dev/tty.usbserial-A700fdrf
Then in the app
File->Examples->FreeDuino_USB_HOST_BOARD->FreeduinoHostBoardDemo
Sketch->Verify/Compile
Sketch->Upload to I/O Board.

Everything went just fine. Compiled the Google ADK DemoKit for Android. Went to try to install that only to learn my Android Device is not Gingerbread (2.3.3)
Sigh
Guess I will have to root the device and install Gingerbread on it.

sean
Posts: 9
Joined: Fri Jun 24, 2011 9:24 pm

Re: Upload problems...

Post by sean »

I am also having trouble uploading.

SYSTEM:
Macbook Pro Core 2 Duo running Arduino 0022, OSX 10.6.7. Able to successfully upload to ordinary Arduino Uno.
Board type selected is Arduino Uno, serial port selected is /dev/tty.usbserial-A700fdqR.

SYMPTOMS & TROUBLESHOOTING:
Attempting to upload a small app results in:

Binary sketch size: 1130 bytes (of a 32256 byte maximum)
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding

While investigating with an oscilloscope I found that C13 had been installed improperly (see attached photo) and saw no clock signal. Pressing RESET did result in Pin 13 cycling, so I presume that AVR uses its internal clock at boot.

After soldering a connection between C13 and its pin (using a short piece of wire) I see a 16 MHz clock signal at about 0.7 volts P-P (0V low, 0.7V peak) on the ATMEGA's PB7 (XTAL2) pin and about 1V P-P (about 0.2V low, 1.2V peak, so it has a slight DC bias) on pin PB6 (XTAL1).

However, after fixing the clock problem, I still get these errors. When I attempt to upload, I can see a total of three very short data transmissions on Arduino pin 0 about five seconds before the first "programmer is not responding" error appears and a final transmission at the moment that first "programming is not responding" appears. On Arduino pin 1 I see one very short data transmission right around the time the three transmissions on pin 0 appear. (I can look into the timing further if need be.)

Any suggestions?

Two more things. I discovered that the two large capacitors next to the power jack are taller than the connector sockets and can crash into pins of a shield plugged into the board, possibly causing a short. I've put some tape over these to prevent that. My Arduino Uno uses 47uF/25V caps which are about half the height (and half the capacitance.) Is there an instability or other issue that requires the larger caps?

Also, terrycarlin mentioned the need for Gingerbread. I had assumed that the ADK required 2.3.4 (Nexus S 4G) based on this page (http://developer.android.com/guide/topics/usb/adk.html). Have I misunderstood the purpose of this board, and can it work on other versions including 2.3.3 (which is currently shipping on the Evo 3D?)

Thanks!

Sean

Edit: I have not figured out how to attach the image showing C13 installed standing on end. When I click the image in "POSTED ATTACHMENTS" after uploading and before submitting, I get this error:
The selected attachment does not exist anymore.
The file ./../files/3434_33d8347c8448b0741b6fc1a4b6291435 does not exist.
IMAG0019.jpg

sonny
Posts: 1
Joined: Sun Jun 26, 2011 12:44 pm

Re: Upload problems...

Post by sonny »

terrycarlin wrote:I figured out this one. I had installed the USB_Host libraries from somewhere else..
I'm a newb at this, but the problem seems to be the instructions on the Android site that have you place their USB_Host_Shield directory in the /libraries folder. I copied the files from Freduino_USB* to this directory and the compile and upload went fine.
terrycarlin wrote:Went to try to install that only to learn my Android Device is not Gingerbread (2.3.3)
Yes, on to this problem for me as well...

oz
Site Admin
Posts: 542
Joined: Mon May 12, 2008 4:19 pm

Re: Upload problems...

Post by oz »

Sean,

Regarding larger caps. We wanted to include a robust power system since the phone may require charging at 500 mA and there may be other things powered by the board. I'm absolutely positive that most things would run fine with 47 u caps. What one hopes to avoid is plugging in the phone and having the power drop low enough to reset the board. This was also done with an eye to providing a "2560" board next.

The larger caps are mostly just higher quality too - probably not a big deal in the overall design. They may be in an environment where some extra heat is generated by the regulator.

The only thing I can tell you about Android distributions that will work with the board, is that they require the new "accessory mode" built in.

You can check that with your phone suppliers. We're currently testing on a Samsung Nexus S, and HTC Innovation.

Paul

sean
Posts: 9
Joined: Fri Jun 24, 2011 9:24 pm

Re: Upload problems...

Post by sean »

paul wrote:Regarding larger caps. We wanted to include a robust power system since the phone may require charging at 500 mA and there may be other things powered by the board. I'm absolutely positive that most things would run fine with 47 u caps. What one hopes to avoid is plugging in the phone and having the power drop low enough to reset the board.
Thanks for the explanation!
paul wrote: The larger caps are mostly just higher quality too - probably not a big deal in the overall design. They may be in an environment where some extra heat is generated by the regulator.
That's very nice - thanks for doing that. This will probably be permanently installed, eventually, so I'll plan to provide regulated 5V from an external source.
paul wrote: We're currently testing on a Samsung Nexus S, and HTC Innovation.
Are they running 2.3.4?

Here is the image of my board received with C13 installed on its end: http://twitpic.com/5hilsu

That's been fixed with a very short jumper soldered from the top of the cap to the open pin, and I'm seeing 16 MHz oscillation now, but I am still unable to upload (see post #5, above; same error) Any more ideas for troubleshooting this?

Sean

oz
Site Admin
Posts: 542
Joined: Mon May 12, 2008 4:19 pm

Re: Upload problems...

Post by oz »

Sean,

Can you give me some details on where it's not uploading.

Does the sketch compile?
Can you upload the Arduino blink sketch?
Do you have a serial port that you can see appear / dissappear in the Serial Port menu when you plug / unplug the board?
Is connecting with the phone the only problem?
What does the serial monitor say when you try to connect with the phone?

Paul

terrycarlin
Posts: 3
Joined: Fri Jun 24, 2011 2:19 pm

Re: Upload problems...

Post by terrycarlin »

Success!
I got a android 2.3.4 phone. (nexus one). I hooked up a led circuit and a button circuit on a breadboard. Uploaded the sketch and side loaded the android demo app. Things just worked! The slider on the app controlled the led and the switch activated the button icon on the app. Very kewl.

sean
Posts: 9
Joined: Fri Jun 24, 2011 9:24 pm

Re: Upload problems...

Post by sean »

Unfortunately, the July 4th holiday and other projects have prevented me from answering these until now.
paul wrote:Does the sketch compile?
Yes.
paul wrote:Can you upload the Arduino blink sketch?
No. This is the place where I'm stuck. I cannot upload sketches at all. I see the following error:
avrdude: stk500_recv(): programmer is not responding (observed twice)
I can upload the blink sketch and others to a different Arduino Pro.
paul wrote:Do you have a serial port that you can see appear / dissappear in the Serial Port menu when you plug / unplug the board?
Yes, the board is appearing as /dev/ttyUSB0.
paul wrote:Is connecting with the phone the only problem?[/qoute]
I had not attempted a phone connection. I cannot get to the point of uploading the sketch.
paul wrote:What does the serial monitor say when you try to connect with the phone?
I have not gotten that far. The serial monitor, if turned on before an upload, goes away when an upload is attempted.

When I attempt to upload, there is momentary activity on the TX and RX serial lines (see previous posts) but the upload to the board fails. We are talking about uploading from the Arduino IDE to the USB Host board, not between the USB Host board and the phone.

The USB Host board arrived with one of the capacitors needed for crystal oscillation (C13) standing on its end. Although I have since bridged the open end to its pad, and can see oscillation with the scope, boot loading fails. I wonder if the problem is:
- corrupted bootloader, not communicating properly
- ATMEGA/bootloader is responding, but response is getting lost/corrupted between ATMEGA and USB serial input stream
At any rate, it seems that I've done everything that one normally would do to upload. Next will be to try sniffing the serial lines directly with a second serial port and sniffing the USB connection. I will also need to observe other pins on the board. It could be anything. (I recall once finding a problem with a board where the plated-through hole connecting traces that were providing power to a PIC had been etched through, but the PIC got enough voltage/current to power up from pullup resistors connected to various IO pins (!). It would reset only when the program using those pins started executing!)

Thanks!

Sean

sean
Posts: 9
Joined: Fri Jun 24, 2011 9:24 pm

Re: Upload problems...

Post by sean »

I decided to try sniffing the USB interface using Wireshark. I've done this for IP countless times but never for USB. After filtering out some of the noise (using wireshark filter expression "usb.data_len != 0 and usb.transfer_type == 3") and comparing the data sent/received from this board and a working Arduino Uno board, it looks like there is a message with hex contents "30 20". The USB Host board does not seem to respond while there is plenty of data coming back from the Arduino Uno.

According to the stk500 (bootloader) protocol documentation, at http://www.atmel.com/dyn/resources/prod ... oc2525.pdf, the "30" value is a command to obtain or determine synchronization with the ATMEGA device.

It's time to break out a TTL-serial level converter and sniff the actual serial data going between the ATMEGA and USB chips on the USB Host board itself. I think that will be revealing. I am still hopeful this is something dumb that I'm doing... more to follow...

DaveT
Posts: 2
Joined: Tue Aug 02, 2011 11:45 am

Re: Upload problems...

Post by DaveT »

I am having what appears to be the exact same problem sean. I'm assuming it's a hardware issue considering I followed the install steps what appears to be properly and the compiler works fine. Also, I have other Arduino boards that are uploading programs with no issues.

oz
Site Admin
Posts: 542
Joined: Mon May 12, 2008 4:19 pm

Re: Upload problems...

Post by oz »

DaveT,

Are you using Windows 7 64 bit? That seems to be the issue so far. Do you have another machine with a different OS to try it on?
I can swap boards but have no guarantee that a new one is not going to have the same issue. I'm in the process of getting a Windows 7 machine to test on.
There are many reports in Arduino land of the same bootloader issues on Win 7.

Write to us off the forum and we'll test a board and send it out to you to try.

Paul

DaveT
Posts: 2
Joined: Tue Aug 02, 2011 11:45 am

Re: Upload problems...

Post by DaveT »

Paul,

I have tried the hardware on a windows xp 32bit OS. Unfortunately, I don't think this was the problem. I was still unable to upload any code. However, it does recognize the serial port properly. I tried to email your support on tuesday but I haven't heard any response. Do you have any more suggestions? I'm starting to think the board isn't working properly.

Thanks,

Dave.

sean
Posts: 9
Joined: Fri Jun 24, 2011 9:24 pm

Re: Upload problems...

Post by sean »

I finally made some time to examine the board thoroughly and it looks like the ATMEGA328 is responding, but the responses are not getting back to the PC.

I modified another device to convert TTL to serial. With this and a serial program with hex readout capability, here's what I see when I attempt an upload

328 receives hexadecimal 30 20 30 A0 30 20 (STK_GET_SYNC, CRC_EOP, STK_GET_SYNC, ??, STK_GET_SYNC, CRC_EOP)
328 sends 14 10 (STK_INSYNC, STK_OK)
After a pause 328 receives 51 20 (STK_LEAVE_PROGMODE, CRC_EOP)
328 sends nothing more

(commands from http://the-bus-pirate.googlecode.com/sv ... 00_proto.h)

So, the ATMEGA328 is getting data, and is responding. But, the response doesn't seem to get back to the PC (see my previous post about using Wireshark to inspect the USB traffic). I've tried this on a WinXP machine and a Macbook. These machines can talk to a regular Arduino, but not to this device.

I'm at a loss for next steps. Any ideas, or time to try swapping this for another board?

oz
Site Admin
Posts: 542
Joined: Mon May 12, 2008 4:19 pm

Re: Upload problems...

Post by oz »

New board is out to the customer. Awaiting final verdict on the issue

Paul

sean
Posts: 9
Joined: Fri Jun 24, 2011 9:24 pm

Re: Upload problems...

Post by sean »

I wanted to report (belatedly) that the replacement board was received and works like a champ.

I also want to warn people about using Serial.print to send debug messages to the serial console in the Arduino UI.

This was not the problem on the board reported in this issue (I never was able to upload to the original board) but it has been a problem on an Arduino Uno and on the replacement board (and has nothing to do with the replacement board or ModernDevice).

I used Serial.begin(57600) and Serial.println("starting") in the setup() method of my app. I then found it VERY difficult to regain control of the board to upload. It seems that the window of time between a reset and your app's use of Serial for logging can be so small as to be virtually impossible for an upload to succeed. (In the future I am thinking I will require some pin to be pulled high or low before serial configuration occurs, so that I can gain access in the future.)

After fighting this problem for three hours this weekend on both my Arduino Uno and Freeduino USB Host, I am about to purchase another Arduino in the hopes I can use it as an ISP programmer as described here:

http://www.sparkfun.com/tutorials/247

and understanding that Arduino apps are stored in flash starting at memory location 0, flash the "Bare Minimum" app example into that location (obviously using the instructions in the link above only as a guide to figuring out the right commands to write to that location instead of the boot loader location) and overwrite the app that's taking over the serial port.

Any ideas on whether this is likely to work for the Freeduino USB Host board?

sean
Posts: 9
Joined: Fri Jun 24, 2011 9:24 pm

Re: Upload problems...

Post by sean »

I have recovered my replacement Freeduino USB Host board (see previous post.) I purchased an Arduino Uno, wired it as an ISP, and flashed it with the "Bare Minimum" app in the Basic examples. Pictures of the board and links to instructions for building it and reprogramming are here: https://plus.google.com/115676199813038 ... 28ktuo2Nki

Post Reply