How to read/write flash in endpoint0( ) Topic is solved

If you have a simple question and just want an answer.
johnsonyin
Member++
Posts: 16
Joined: Thu Nov 10, 2016 2:33 am

How to read/write flash in endpoint0( )

Postby johnsonyin » Fri Jan 06, 2017 10:52 am

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
View Solution
DemoniacMilk
XCore Addict
Posts: 191
Joined: Tue Jul 05, 2016 2:19 pm
Contact:

Postby DemoniacMilk » Fri Jan 06, 2017 11:19 am

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)
johnsonyin
Member++
Posts: 16
Joined: Thu Nov 10, 2016 2:33 am

Postby johnsonyin » Fri Jan 06, 2017 11:19 am

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!
User avatar
larry
Respected Member
Posts: 261
Joined: Fri Mar 12, 2010 6:03 pm
Contact:

Postby larry » Mon Jan 09, 2017 2:55 pm

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.
johnsonyin
Member++
Posts: 16
Joined: Thu Nov 10, 2016 2:33 am

Postby johnsonyin » Fri Feb 17, 2017 10:32 am

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?
User avatar
larry
Respected Member
Posts: 261
Joined: Fri Mar 12, 2010 6:03 pm
Contact:

Postby larry » Fri Feb 17, 2017 11:56 am

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.
johnsonyin
Member++
Posts: 16
Joined: Thu Nov 10, 2016 2:33 am

Postby johnsonyin » Fri Feb 24, 2017 12:37 pm

Thanks for larry, i got it

Return to “Q&A”

Who is online

Users browsing this forum: No registered users and 12 guests