Hi,
I would like to use the USB port to connect a memory stick and use it read/write files.
I have a old example here which uses "g_fx_media0 FileX on USB Mass Storage".
I am currently using SSP 1.2.1 and I am not finding this framework to add to my project.
Which framework should I use to achieve what I need?
Hi adboc, I inserted the stack as you indicated. Tried to compile it and got these errors: ../src/synergy_gen/common_data.c: In function 'ux_host_init0': ../src/synergy_gen/common_data.c:299:59: error: 'SYNERGY_NOT_DEFINED_initialize' undeclared (first use in this function) SYNERGY_NOT_DEFINED_initialize, SYNERGY_NOT_DEFINED, ^ ../src/synergy_gen/common_data.c:299:91: error: 'SYNERGY_NOT_DEFINED' undeclared (first use in this function) SYNERGY_NOT_DEFINED_initialize, SYNERGY_NOT_DEFINED, ^ ../src/synergy_gen/common_data.c:300:59: error: 'UX_SYNERGY_CONTROLLER' undeclared (first use in this function)
The function is that one: void ux_host_init0(void) { /** Register a USB host controller. */ UINT status_g_ux_host_0 = ux_host_stack_hcd_register ((UCHAR*) "SYNERGY_NOT_DEFINED", SYNERGY_NOT_DEFINED_initialize, SYNERGY_NOT_DEFINED, UX_SYNERGY_CONTROLLER); if (UX_SUCCESS != status_g_ux_host_0) { g_ux_host_0_err_callback (NULL, &status_g_ux_host_0); } } What should I create to replace SYNERGY_NOT_DEFINED_initialize, SYNERGY_NOT_DEFINED and UX_SYNERGY_CONTROLLER?
EDIT:
I saw this is new content from 1.2.1.
The only examples I could find are using 1.2.0.
Is there any examples of how to use the FX on USB in the new 1.2.1? (Or at least how to compile the auto-generated code)
I tried to replace:
/** Register a USB host controller. */ UINT status_g_ux_host_0 = ux_host_stack_hcd_register ((UCHAR*) "SYNERGY_NOT_DEFINED", SYNERGY_NOT_DEFINED_initialize, SYNERGY_NOT_DEFINED, UX_SYNERGY_CONTROLLER);
for:
/** Register a USB host controller. */ UINT status_g_ux_host_0 = ux_host_stack_hcd_register ((UCHAR*) "Anything",ux_hcd_synergy_initialize, UX_SYNERGY_CONTROLLER,UX_SYNERGY_CONTROLLER_S3A7);
But the e2studio undo my changes when I compile the code! The code goes back to its original content (which doesn't compile!).
So, the Synergy generate a file that doesn't compile and I can't edit that file.
Now, what can I do?
Hi Mad River,
The SYNERGY_NOT_DEFINED is a place holder because you have not selected a required module and configured it.
Please verify your configuration is correct. You can not edit files in the synergy or the synergy_gen folders because they are auto-generated when you build. You must change your configuration in the Synergy Configurator to fix these files.
Here is an example of properly configured USB mass storage host configuration:
-Gary
HI Mad River,
As Gary indicated, your SSP configuration is incomplete so some parameters are missing from the Synergy_cfg, etc. I attached USBX_Mass_Storage_Host_PKS5D9.zip as an example to show how to configure and setup in the SSP1.2.1. The pool memory size is dependent on your selected device and USB classes. The SSP User Manual lists recommended pool sizes for these combinations. Please let me know if you have any questions. Thanks
Joe
Hi everyone, Thanks to your help I was able to compile the generated code. Now, I am trying to run it. As soon I resume the application, my program goes to: void g_fx_media0_err_callback_failed_to_get_fx_media_internal(void * p_instance, void * p_data) { /** Suppress compiler warning for not using parameters. */ SSP_PARAMETER_NOT_USED (p_instance); SSP_PARAMETER_NOT_USED (p_data); /** A FileX media control block for a USB mass storage device was not found. */ BSP_CFG_HANDLE_UNRECOVERABLE_ERROR (0); } Am I missing some initialization?
Deeper debug indicates that the problem occurs here:
void fx_media_init_function0(void){ /** Suspend the thread until a USB Mass Storage Device inserted. */ UINT err_g_fx_media0_semaphore_get = tx_semaphore_get (&ux_host_storage_semaphore_insertion, 1000); if (TX_SUCCESS != err_g_fx_media0_semaphore_get) { g_fx_media0_err_callback_failed_to_get_fx_media (&ux_host_storage_semaphore_insertion, &err_g_fx_media0_semaphore_get); }
I am confused about this comment "/** Suspend the thread until a USB Mass Storage Device inserted. */"
In my application the USB memory stick is not inserted at startup time.
The user can eventually insert the USB memory stick while the application is already running.
The USB memory stick may even never be inserted.
Mad River,
Here is an example of using the host change call back & event flags to init the media when its inserted.
SK_S7_USB_MSC_Host_Example.zip
Hello Mad River,
You can disable auto initialization and perform it yourself after the USB stick has been inserted. Please refer to the following example project for SK-S7 and SSP 1.2.0: s7_sk_ux_mass_host_1_2_0.zip. On SSP 1.2.0, you cannot call initialization from the insertion callback (init will block waiting for a semaphore that's placed only after the callback) so you'll need to use another semaphore to signal a thread to perform initialization.
Regards