Can the PE FSL_USB_STACK use Clock Source 1

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

Can the PE FSL_USB_STACK use Clock Source 1

1,543 Views
neilhancock
Contributor IV

A qu before the xmas break from Ca(GMT-8hrs), maybe to Eric as its FSL_USB_STACK (and Eirc has already posted Xmas sunrise in Switzerland)

 

I'm using KDS200 with ProcessorExpert FSL_USB_STACK and when I see the

FSL_USB_STACK . Settings.Clock settings. Clock Divider its marked as STOPPED

I've got my

ClockSource0 as a lowPower LowSpeed Clock on startup

ClockSource1 as 96Mhz clock

Is this why I'm getting STOPPED?

Is there anyway for it to use Clock Source 1?

18076_18076.jpgPeFslUsbStackClockSettings.JPG.jpg

 

2nd Qu for FSL_USB_STACK

- I selected CPU Kinetis K20D72 - and it told me it wasn't available. Can I still set it to K20D50 - as they seem the same as far as the USB?

 

many thanks

Labels (1)
Tags (2)
7 Replies

1,174 Views
BlackNight
NXP Employee
NXP Employee

Hi Neil,

RE question 1: If it shows 'STOPPED', it means that this input clock to the USB module is not running. You problably have not selected the proper PLL/FLL clock in the output settings in the CPU component (setting shown for K64F, but should be similar for your K20):

pastedImage_1.png

Make sure you select 'PLL' there, so the PLL clock is routed to the USB peripheral.

That's something easily missed, so I try to point it out in my tutorials (e.g. USB with the TWR-K60F120M and TWR-K70F120M | MCU on Eclipse), but the setting might be different for the given Kinetis Family.

RE question 2: Which USB device class are you using? K20D72 is supported (at least in the lastest release):

pastedImage_3.png

Are you using the latest drop from SourceForge (McuOnEclipse Releases on SourceForge | MCU on Eclipse, McuOnEclipse | SourceForge.net)?

I hope this helps, and Merry Christmas,

Erich

1,174 Views
neilhancock
Contributor IV

HI Eric - Season Greetings, and thanks for the reply.

Also great to get an update for the "Components 2014-12-27.zip" wow on Saturday - I pulled that in and it now generates for the K20D72. Many thanks.

Here is my clock sources -

ClockConfiguration1 does have the PLL/FLL clock selection enabled,

but NOT ClockConfiguration0 - so I'm guess the FSL_USB_STACK is  keying off ClockConfiguration0. There isn't a choice that I can see of.

B022cLlsModeClockSources141225ann.jpg

B022cLlsModeUsb0ClockSettings141227.JPG.jpg

I did have a look at the "ProcessorExpert.pe" file to see if there was anyway I could switch around the definitions of Clock Config/Source 0/1 - but the tags didn't match textually to what I see on the screen.

So I assume I'm going to have to work through recreating the clocks with the USB being defined in Clock Config 0

Its probably not a lot of work - I initially had ClockConfig0 as a low power startup, but I think there are other ways of ensuring a low power startup - still have to experiment.

Many thanks for your insights

0 Kudos
Reply

1,174 Views
BlackNight
NXP Employee
NXP Employee

It is using clock configuration 0, I don't think there is a way to get around this.

Erich

1,174 Views
neilhancock
Contributor IV

Hello Erich, Thanks for the response.

I've moved all the clock settings to ClockSourceSetting0  for 48Mhz and it compiles, downloads OK and runs.

All the settings for the USB stack are the same as your McuOnEclipse USB MSD settings for the FRDM-K20D50 except for selecting the K20D72

I've the two tasks - one Host and the other Shell.c

The shell responds with help/status.

I have the Hosttask instrumented with a led_neg() to see it polling the FsMSD1_appTask() and CheckStatus()

On power up - it services a USB_ISR and finds nothing, returns and carries on running.

On a USB Stick being plugged in - it generates a USB_ISR, runs and detects an attach in khci_kinetis.c

This is processed with

_usb_event_set(&khci_event, KHCI_EVENT_ATTACH);

However, it then does nothing with it.

It seems to disable some interrupts including

Events.c:TI1_OnInterrupt() {

  delay_count++;

}

stops being called, which results in sitting in a delay loop waiting - I think in the hosttask.

This is pretty broad description - I've been reading the manual to understand UsbHost and ISRs better - i wonder if you have any pointers where to look.

Many thanks

Neil

0 Kudos
Reply

1,174 Views
BlackNight
NXP Employee
NXP Employee

Hi Neil,

that looks like a reentrancy issue I just have fixed a few days ago on GitHub (added flexible heap management to host stack, fixed critical section iss... ·  dc5b4e7 · ErichStyger...). The problem only exists for Kinetis K (not L).

Because these changes are not in a *.PEupd release on SourceForge.net, I have attached the latest components for USB.

I hope this helps,

Erich

1,174 Views
neilhancock
Contributor IV

Wow thanks for the response. I added the fix, and also looked at it to make sure it was there and follow the anatomy of the fix - I'm on a learning curve.:)

On downloading, it didn't seem to help. Still gets stuck in a delay loop as the Events.c:TI1_OnInterrupt() appears to be disabled.

For some reason  my component Timer TI1 I was using LPTIMER and your  FRDM-K20D example was using the FTM0_MOD timer - so I switched to it - and it works. Wow. Fantastic:smileyhappy:

Or at least one of my USB Sticks can see and list the directory. Fantastic.!!!!

However another USB stick that was working with the FRDM-L25z mbed FAT doesn't show up  - oh well, next problem. But fantastic - can now play with the FAT:smileycool: parameters and filesizes.

Hey, since Switzerland is pretty close to New Year - Happy New Year 2015.:smileysilly:

Maaaannnnnyyyy thanks for the blog and putting together the examples:heart:.

Talk to you next year.

0 Kudos
Reply

1,174 Views
BlackNight
NXP Employee
NXP Employee

Hi Neil,

ah, that now makes sense: the LPTIMER is not running unless you are in low power mode or have configured the timer in a special way. This explains the problem. Still, the other fix is necessary, otherwise you would have been running into another problem :smileysilly:.

Happy New Year (in 3.5h) :-)

Erich

0 Kudos
Reply