romerod / USB_Host_Shield_2.0

Revision 2.0 of USB Host Library for Arduino.
http://www.circuitsathome.com
MIT License
0 stars 0 forks source link

Hanging in usbhost.h > int8_t MAX3421e< SPI_SS, INTR >::Init() #1

Open romerod opened 8 years ago

romerod commented 8 years ago

Hanging in while loop //wait for sample operation to finish

romerod commented 8 years ago

@Lauszus do you have an idea why this happens? I'm trying to add support for the mediatek linkit one, see branch mediatek_linkit_one

As the code works until that line, basic SPI communication seems to work.

Lauszus commented 8 years ago

Maybe you need to set the poll interval: https://github.com/romerod/USB_Host_Shield_2.0/commit/e7bb5fafb1656807510f10b19a56814233636a36 or maybe you are having the following problem: https://github.com/felis/USB_Host_Shield_2.0/commit/fb723fcbb02c9b343209b954eff53bef5a7316e4?

Lauszus commented 8 years ago

Usb.Init() works correctly, right? Have you tried running the following example: https://github.com/romerod/USB_Host_Shield_2.0/blob/master/examples/board_qc/board_qc.ino?

romerod commented 8 years ago

It hangs exactly in USB.Init() on the loop where it's waiting for the sample operation. The primary setup in the Init seems to work.

romerod commented 8 years ago

I've just discovered that the rst pin on the spi connector on the linkit one isn't connected, is that one used?

romerod commented 8 years ago

I've both commits you mentioned in the link it one branch

Lauszus commented 8 years ago

Sorry but Usb.Init is not called in loop(), so I am not sure where you say it hangs? Yes the reset pin should be connected.

romerod commented 8 years ago

There is a loop in the Init function it's there where it hangs

Lauszus commented 8 years ago

Okay so it is blocking somewhere in here: https://github.com/romerod/USB_Host_Shield_2.0/blob/master/usbhost.h#L384-L419. Can you add some print statements, so we can figure out where it hangs.

romerod commented 8 years ago

Already did that it hangs here:https://github.com/romerod/USB_Host_Shield_2.0/blob/master/usbhost.h#L411-L411

-------- Ursprüngliche Nachricht -------- Von: Kristian Sloth Lauszus notifications@github.com Datum: 01.01.2016 15:40 (GMT+01:00) An: "romerod/USB_Host_Shield_2.0" USB_Host_Shield_2.0@noreply.github.com Cc: Daniel Romero daniel.romero@baseclass.ch Betreff: Re: [USB_Host_Shield_2.0] Hanging in usbhost.h > int8_t MAX3421e< SPI_SS, INTR >::Init() (#1)

Okay so it is blocking somewhere in here: https://github.com/romerod/USB_Host_Shield_2.0/blob/master/usbhost.h#L384-L419. Can you add some print statements, so we can figure out where it hangs.

Reply to this email directly or view it on GitHubhttps://github.com/romerod/USB_Host_Shield_2.0/issues/1#issuecomment-168311318.

Lauszus commented 8 years ago

Make sure it is using SPI mode 0 and that and the bitorder is set to MSBFIRST. Please see: http://labs.mediatek.com/site/global/developer_tools/mediatek_linkit/api_references/SPIClass__setDataMode@uint8_t.gsp and http://labs.mediatek.com/site/global/developer_tools/mediatek_linkit/api_references/SPIClass__setBitOrder@BitOrder.gsp.

Do you got access to a logic analyser?

romerod commented 8 years ago

I did that to, mode 0 is the default, but iI will try to set it either way, I've set the bit order in the meantime (didn't comit that yet), didn't help...

I've no logic analyzer...

-------- Ursprüngliche Nachricht -------- Von: Kristian Sloth Lauszus notifications@github.com Datum: 01.01.2016 17:33 (GMT+01:00) An: "romerod/USB_Host_Shield_2.0" USB_Host_Shield_2.0@noreply.github.com Cc: Daniel Romero daniel.romero@baseclass.ch Betreff: Re: [USB_Host_Shield_2.0] Hanging in usbhost.h > int8_t MAX3421e< SPI_SS, INTR >::Init() (#1)

Make sure it is using SPI mode 0 and that and the bitorder is set to MSBFIRST. Please see: http://labs.mediatek.com/site/global/developer_tools/mediatek_linkit/api_references/SPIClass__setDataMode@uint8_t.gsp and http://labs.mediatek.com/site/global/developer_tools/mediatek_linkit/api_references/SPIClass__setBitOrder@BitOrder.gsp.

Do you got access to a logic analyser?

Reply to this email directly or view it on GitHubhttps://github.com/romerod/USB_Host_Shield_2.0/issues/1#issuecomment-168315101.

Lauszus commented 8 years ago

Okay :( Double check all your connections. If it is still not working you should look at the SPI communication using either a scope og logic analyser and see if you can figure out what is wrong.

romerod commented 8 years ago

OK, but I'm using the full size USB host shield, and the shield works fine on an arduino so the connections are OK, what is the reset pin on the icsp connector used for? As this one isn't connected on the linkit one, should I connect it to another digital output?

If yes, what do I do with it? (when to set it high/low)

-------- Ursprüngliche Nachricht -------- Von: Kristian Sloth Lauszus notifications@github.com Datum: 01.01.2016 20:06 (GMT+01:00) An: "romerod/USB_Host_Shield_2.0" USB_Host_Shield_2.0@noreply.github.com Cc: Daniel Romero daniel.romero@baseclass.ch Betreff: Re: [USB_Host_Shield_2.0] Hanging in usbhost.h > int8_t MAX3421e< SPI_SS, INTR >::Init() (#1)

Okay :( Double check all your connections. If it is still not working you should look at the SPI communication using either a scope og logic analyser and see if you can figure out what is wrong.

Reply to this email directly or view it on GitHubhttps://github.com/romerod/USB_Host_Shield_2.0/issues/1#issuecomment-168332461.

Lauszus commented 8 years ago

You should simply connect reset to 3.3V then.