Page 1 of 1

How to read/write flash in endpoint0( )

Posted: Fri Jan 06, 2017 10:52 am
by johnsonyin
For xu216, Add fl_connectToDevice( ) in endpoint0 (),which is on tile[XUD_TILE=1], it always return None Zero value, can't read/write flash. can I do it like this? if I can, what shall I do ? thanks

Re: How to read/write flash in endpoint0( )

Posted: Fri Jan 06, 2017 11:19 am
by DemoniacMilk
What ports/pins is your flash connected to?

If your USB endpoint is running on a core on tile 1, then calling fl_connect(ports) will try to connect to the flash device using ports on tile 1.

Be aware that (for example) XS1_PORT_1E names a port within a tile, but on tile[0]: XS1_PORT_1E and on tile[1]: XS1_PORT_1E are in fact different ports/pins.

If your flash is connected to pins on a tile other than the USB tile, then you need to get the data you want to write/read from one tile to another tile. For this you may use a channel or an interface.

USB Tile: endpoint <-> chanend/interface
Flash tile: chanend/interface <-> flash_task (access flash here)

Re: How to read/write flash in endpoint0( )

Posted: Fri Jan 06, 2017 11:19 am
by johnsonyin
DemoniacMilk wrote:What ports/pins is your flash connected to?

If your USB endpoint is running on a core on tile 1, then calling fl_connect(ports) will try to connect to the flash device using ports on tile 1.

Be aware that (for example) XS1_PORT_1E names a port within a tile, but on tile[0]: XS1_PORT_1E and on tile[1]: XS1_PORT_1E are in fact different ports/pins.

If your flash is connected to pins on a tile other than the USB tile, then you need to get the data you want to write/read from one tile to another tile. For this you may use a channel or an interface.

USB Tile: endpoint <-> chanend/interface
Flash tile: chanend/interface <-> flash_task (access flash here)
thanks for your message, DemoniacMilk!

Re: How to read/write flash in endpoint0( )

Posted: Mon Jan 09, 2017 2:55 pm
by larry
You'll also need to make sure endpoint zero doesn't get stalled for too long (e.g. scanning the flash or erasing). I believe the USB spec requires it to respond to requests within 500ms.

Re: How to read/write flash in endpoint0( )

Posted: Fri Feb 17, 2017 10:32 am
by johnsonyin
DemoniacMilk wrote:What ports/pins is your flash connected to?

If your USB endpoint is running on a core on tile 1, then calling fl_connect(ports) will try to connect to the flash device using ports on tile 1.

Be aware that (for example) XS1_PORT_1E names a port within a tile, but on tile[0]: XS1_PORT_1E and on tile[1]: XS1_PORT_1E are in fact different ports/pins.

If your flash is connected to pins on a tile other than the USB tile, then you need to get the data you want to write/read from one tile to another tile. For this you may use a channel or an interface.

USB Tile: endpoint <-> chanend/interface
Flash tile: chanend/interface <-> flash_task (access flash here)

i meet other problem with interface communication, add interface parameter to endpoint0 ( ), it always compile error.
D:/sw_usb_audio-[sw]_6.15.2rc1/sc_usb_audio/module_usb_audio/endpoint0\endpoint0.h:25:127: error: interface declared inside parameter list
chanend ?c_mix_ctl,chanend ?c_clk_ctl, chanend ?c_EANativeTransport_ctr, client interface i_dfu dfuInterfaces, server interface flashread i );
can i use interface communication in C file?

Re: How to read/write flash in endpoint0( )

Posted: Fri Feb 17, 2017 11:56 am
by larry
can i use interface communication in C file?
You can't call interface functions in C. You can pass interfaces along in C. That's using CLIENT_INTERFACE and SERVER_INTERFACE macros from xccompat.h.

Re: How to read/write flash in endpoint0( )

Posted: Fri Feb 24, 2017 12:37 pm
by johnsonyin
Thanks for larry, i got it