Trying to use Processor Expert and failing

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

Trying to use Processor Expert and failing

Jump to solution
10,829 Views
jrychter
Contributor V

I'm new to the Kinetis family. I am trying to use Processor Expert, as I really like the idea — but even with seemingly simple tasks I end up running into huge problems.


Here's an example. I created an application on the FRDM-KL05 board, it generates three PWM signals (driving the on-board LED) with slowly changing duty cycles. I used three PWM_LDD drivers, all sharing a single TimerUnit. Another TimerUnit is used by a TimerInt LDD, which slowly generates events where I change the duty cycle of the three PWMs.


I managed to click all this into working shape and had it successfully run on the FRDM board. Everything worked. But when, later in the day, I came back and re-opened that project, it was full of errors. It shows conflicting pins, even though there were no conflicts before. And after opening the TU1 TimerUnit one can see that things are really messed up: some settings seem to be duplicated and there are indeed conflicts there, even though there are no conflicts in the PWM LDDs that use the TimerUnit. I've attached screenshots.

There are two problems here: one — how did Processor Expert get into that state? Is that a bug? If it is, and if I can hit a bug like this with a simple app, do people actually use Processor Expert for larger projects? And second problem — how do I fix this? I didn't think I was supposed to meddle in the "referenced components", I thought the whole point was that PE would manage those for me?

Am I doing something wrong?

This is with CodeWarrior 10.5.



1 Solution
3,961 Views
Petr_H
NXP Employee
NXP Employee

Please find attached a hot-fix package for this problem for CodeWarrior for MCUs V10.5.

If you have an existing project that was already broken, it's necessary (after applying the hot-fix) to delete the TimerUnit_LDD and PWM_LDD components from the project and add them again and set required values.

The package doesn't fix the glitch that sometimes incorrectly changes the devices after the pin is changed, so I recommend to select the pin first and the select the devices according the pin. This issue will be fixed in the next Processor Expert / CodeWarrior release as it needs a change in the Processor Expert core.

Please let us know if you'd need more help.

best regards

Petr Hradský

Processor Expert Support Team

View solution in original post

0 Kudos
Reply
11 Replies
3,961 Views
mevon
Contributor II

Wow, PEx is really simple to use when you have the components for your cpu model!

(see this post: There is a Time and Date for both Worlds | MCU on Eclipse )

One thing I realized is that in all the examples I seeked, everthing about USB MSD was for HOST. Even though it was not mentioned explicitly, it was all for the hosting of mass storage devices (like thumbdrives) on the usb. Maybe I'm not getting all the information I need and maybe it's the same thing, or maybe I need to use OTG in Device mode only, or maybe I just haven't found/written the right PEx component yet..

So if anyone can help me out here, I would need an example or tutorial on the subject : MK20DX256VLH7 as USB MSD not HOST (with SD card and Fat FS optionally, I got that part working). I would like to be able to plug my board in a computer and have the content of the SD card available in file directory to read and write files over USB, like an ordinary thumbdrive, but not for reprogramming / hex uploading purposes.

Thanks in advance,

Mevon

0 Kudos
Reply
3,961 Views
mevon
Contributor II

Hi Everyone,

Being new to Kinetis, I am too struggling to get my project started. I mean, at first sight, it is nice to see a lot of "support", free usb stack, and many many examples available but making the first steps are quite hard. I know I have a lot more work to do to get on the right track but it seems all the Freescale documentations aren't enough for me. Specially with project examples for the usb stack, the 2 page "tutorial" on the different subjects is just not enough. I've been diving into the many tutorial of Erich Styger, and I am very thankful for them, but it seems it is missing some in-between tutorials. I was glad I could install PEx on Eclipse, the step by step tutorials are awesome, but I couldn't find the right information, like on how to create a Processor Expert project, how to add components and what are the things to watch out for at first. I need a tutorial going through the basics of PEx, how to add components, how to use the components and configure them properly. My next option is the KDS IDE but I'm still waiting for the nda approval. I just hope the 3rd time is a charm (I failed with the Open source IDE, failed with CW10.5 examples, and I can't seem to grasp anything with the PEx examples, may it be from the 4.1.1 usb stack examples or the ones with CW10.5).

So, if anyone can post me a link to some turtorial to help me getting started with my K20D72 project, I would be very happy! I know it is supposed to be easy to switch from K20D50 to using MK20DX256VLH7 but I would like to have more explainations on how to create a basic PEx project from scratch and add some other PEx features in it.

Please advise,

Mevon

EDIT: I am looking into these pages for answers right now..

Tutorial: PWM with Processor Expert | MCU on Eclipse

PWM and Shell for a LED | MCU on Eclipse

Toggling Pin on Kinetis Using a Timer Output

0 Kudos
Reply
3,961 Views
Petr_H
NXP Employee
NXP Employee

Hi,

I have looked on the screenshot it seems that the problem might come from the conflict of PWM_LDD components with TimerInt_LDD components that are configured to use the same TimerUnit_LDD component on the same timer (with multiple channels).

The PWM_LDD and TimerInt_LDD are just a wrappers that provide some additional API (methods) but they use TimerUnit_LDD that is selected when the component is added to the project. In case of sharing one timer with more components the conflicts often occurs (e.g. same period muse be in all components using one timer etc..).


To be able to reproduce the problem, could you provide us a project with the problem or at least the ProcessorExpert.pe ?


Generally, for more complex configurations on the a timer like this (some channels do PWM, some do periodic interrupt, some may do output on pis etc...), there my be more straight-forward to use directly the  TimerUnit_LDD that can handle all this by itself.

For introduction to configuring TimerUnit_LDD, you can check this tutorial: Toggling Pin on Kinetis Using a Timer Output

If you send us your requerements, we can provide you configuration example for your needs.

best regards

Petr Hradsky

Processor Expert Support Team

3,961 Views
jrychter
Contributor V

Thank you for your help. I have attached the complete project. Please treat this as a bug report rather than a request for help — this is just a toy project, I'm trying to get a feel for how well Processor Expert works. Please note that this project *worked*: the three PWM_LDD components shared a single TimerUnit, three channels were used (note that I use the same period for all PWM components), the project compiled into a binary that worked on my board as intended.

Things broke after I closed the project and reopened it again.

I think I will use PE for initialization and certain drivers only — it seems to use it well you need to know the combinations of components that fit well together, and that information is not easily obtained. In another evaluation project I had much better luck using PE to initialize the board and peripherals, but working the timer myself.

0 Kudos
Reply
3,961 Views
Petr_H
NXP Employee
NXP Employee

Thank you, I have reproduced the problem. It has been classified as a defect and we are preparing a solution. I'll keep you informed.

We are sorry for the inconvenience.

I agree that the selection of the components might be confusing for non-experienced users, so we are preparing some improvements in this area.

Briefly, the main built-in component types are :

- Peripheral Initialization components - their name starts with Init_ and they provide a complete initialization code for a peripheral. 

- Logical Device Driver (LDD) - a components that provide initialization and runtime methods, designed for Kinetis. They can be used with RTOS.

- High level components, Low level components - a legacy set of components providing both initialization and runtime control. On Kinetis, they are often inheriting (using) some LDD component for their operation

You can see this type in the Components library view. A detailed information for each component is accessible using component pop-up menu command "Help on component".

best regards

Petr Hradsky

Processor Expert Support Team

0 Kudos
Reply
3,962 Views
Petr_H
NXP Employee
NXP Employee

Please find attached a hot-fix package for this problem for CodeWarrior for MCUs V10.5.

If you have an existing project that was already broken, it's necessary (after applying the hot-fix) to delete the TimerUnit_LDD and PWM_LDD components from the project and add them again and set required values.

The package doesn't fix the glitch that sometimes incorrectly changes the devices after the pin is changed, so I recommend to select the pin first and the select the devices according the pin. This issue will be fixed in the next Processor Expert / CodeWarrior release as it needs a change in the Processor Expert core.

Please let us know if you'd need more help.

best regards

Petr Hradský

Processor Expert Support Team

0 Kudos
Reply
3,961 Views
chrled
Contributor I

Hi Petr,

Would you please tell me how to know if I need to install this hot fix ?

Do the updates fix that issue or I still need to install the hot fix ?

I install CW 10.5 on Oct 2013:

     Processor Expert for MCU

     Version 10.3.0

     Build: RT5_b1337-1809

     Copyright © 2007-2013 Freescale Semiconductor, Inc.

Screen Capture 2014-02-24 19.13.14.jpg

Best Regards,

Christian

0 Kudos
Reply
3,961 Views
jrychter
Contributor V

Thank you for the help, I am glad you were able to find the problem and fix it.

0 Kudos
Reply
3,961 Views
offgrid
Contributor III

Hi Jan,

I'm running into some of the same questions you have about PE and Kinetis.

I'm working through the issues, some of the limitations are my own, and my limited knowledge of this chip family and of Processor Expert. But I do keep feeling that I can code much faster than PE, considering I have to check so many things after the expert software has done it's job and the software is not working, requiring  (I hate to admit it but) hours of head scratching in one case.

But it does provide a starting point, and a lot of the code (but not all) runs out of the box, so I keep telling myself to hang in there and it will become easier. This forum seems to be on a frequent interrupt, so it's easy to get help, and Erich's blog (and his help) are totally indispensable. So I am likely to stick with the K20 chip family for now, and maybe start hard-coding to get some work done.

Hope it helps to know you are not alone...

Tim

offgrid

0 Kudos
Reply
3,961 Views
BlackNight
NXP Employee
NXP Employee

Hi Jan,

an easy one first:

>>do people actually use Processor Expert for larger projects?

Yes, at least I do :-). Projects with > 50 components, with applications from <10k up to 512 KByte of code.

You can find a selection of example projects here: mcuoneclipse/Examples at master · GitHub

As for your actual problem: this indeed looks like a bug in Processor Expert around the PWM_LDD component.

I just filed this week end a ticket which looks similar to the issue you have. But I was able to generate code anyway.

I suggest you file a service request if not already done.

Anyway, if you are starting using Processor Expert, you probably should *not* start with the _LDD components. What I use is the much simpler to use PWM component:

Tutorial: PWM with Processor Expert | MCU on Eclipse

The other thing to be aware of: The timer channels on the Kinetis are unfortunately not as easy to use as on other Freescale processors (e.g. S08). As another point: if you are using a TPM module, the 'master' frequency of all channels need be the same: All the channels in a TPM need to use the same input clock and the same match register of the block (see the data sheet and block diagram of the TPM).

I'm using PWM with the LED's too, but using my own Processor Expert components:

http://mcuoneclipse.com/2012/12/29/pwm-and-shell-for-a-led/

This might be an option for you too (if it is about LED's). I have attached you a project you could use as a starting point.

But it is using my own Processor Expert components, so make sure you load the additional components first. See

Processor Expert Component *.PEupd Files on GitHub | MCU on Eclipse

If you build the attached project, connect to the FRDM-KL05Z with 38400 baud. Then you can change the PWM duty of each LED with the command line shell (see PWM and Shell for a LED | MCU on Eclipse).

I have attached the same project as on GitHub (mcuoneclipse/Examples/FRDM-KL05Z/KL05Z_FreeRTOS at master · GitHub), but with all the sources generated (It has the S19 file in it so you could try it out right away).

Last but not least: as with any new microcontroller, it always takes some time to learn new things. It is painful at the beginning, but will get much easier after a while. Keep going!

I hope this helps.

3,961 Views
jrychter
Contributor V

>>do people actually use Processor Expert for larger projects?

Yes, at least I do :-). Projects with > 50 components, with applications from <10k up to 512 KByte of code.

Thank you, that is reassuring to hear. After lots of banging my head against the wall in PE I started having doubts. I think I hit at least three bugs within the first few hours of using it.

Thanks for the hints — I was unaware that the PWM component existed and even now I am not entirely clear on its purpose (the distinction between PWM and PWM_LDD). I wish there was a good overview of PE (I did read the User Guide and in my opinion it isn't enough). I guess I should just work through most of your tutorials.

Last but not least: as with any new microcontroller, it always takes some time to learn new things. It is painful at the beginning, but will get much easier after a while. Keep going!

Well, I realize that — but I did not expect things to break so much. I do have a comparison, as I have used Grace (MSP430 configuration tool). It is simpler than PE, and has its problems, but seems much easier to use and I didn't hit as many bugs with it as I did with PE.

I'm just trying to judge whether PE is worth the effort — perhaps it makes more sense to work without it, possibly "stealing" some init code and/or driver code when needed.

0 Kudos
Reply