problem with deinit_msc_class function

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

problem with deinit_msc_class function

845 Views
arthshah
Contributor II

hello kerryzhou

i am working on USB_MSD on kl26z.

i successfully got my SD as a MSD in my kl26z freedom board.

now i want  to remove my MSD task and start other task by pressing one key.

so i am executing USB_Class_MSC_Deinit(&g_disk.app_handle); function.

it's give return value USB_OK but still my disk show as MSD and i am trying to Dettech my cable and agian attech my cable its show disk again but i don't want to show disk again without pressing key.

how m i control this functionality??

0 Kudos
6 Replies

736 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Arth,

    About the SCB_AIRCR_SYSRESETREQ_MASK and SCB_AIRCR definition.

You can find it from the core_cm0plus.h file.

 So, the software reset code can be:

#define Reset()      (SCB_AIRCR = (0x5FA<<SCB_AIRCR_VECTKEY_Pos) | SCB_AIRCR_SYSRESETREQ_Msk)

After you deinitial the MSD, then do the software reset, in the main code, you need to check the reset type, if it is the software reset, don't initialize the MSD again.

Wish it helps you!


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

736 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Arth Shah,

    That's very good to hear you already make the USB MSD works on the KL26Z board.

    I think you can try do a software reset after you press one key, when detect the key is press, then do the software reset, in the code start area, check the software reset, RCM_SRS1[SW], if it is 1, then do your another task, don't do the USB initialization.

The software reset code is:


#define Reset()      (SCB_AIRCR = SCB_AIRCR_VECTKEY(0x5FA)|SCB_AIRCR_SYSRESETREQ_MASK)

You can try it.

If it is still not OK and you are convenient, you can share your USB MSD code with me, I will help you to check it.

Wish it helps you!


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

736 Views
arthshah
Contributor II

hello kerryzhou

thanks for the reply.

i am just trying to do software reset,

but i can't understand your method.

first of all i just define reset as you said me.

now in one task i check my key if key is pressed then called reset and now what to do with this??

 -> RCM_SRS1[SW],

0 Kudos

736 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Arth,

   In your project, when the code start, enter the main function, then check RCM_SRS1[SW], if it is 1, then do your another task, else do your USB task.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

736 Views
arthshah
Contributor II

hello kerryzhou

i have successfully implement these logic but it's not reliable solution of my problem.

i want to add USB_CDC also in USB_MSD and other application.

how to properly disable USB_MSD using API?

because i want to control on CDC and MSD please give me solution of this.

thanks

Arth Shah

0 Kudos

736 Views
arthshah
Contributor II

hello kerry,

i understand what you say but in my project there are error like
'SCB_AIRCR_SYSRESETREQ_MASK' undeclared 
'SCB_AIRCR' undeclared 
'SW' undeclared (first use in this function) 

now what to do?

is it require to add any header file? or something else?

0 Kudos