Everything you always wanted to know about Eclipse, Embedded Systems Programming, Software and Tools, or any topics of this blog, but where afraid to ask, then this page is for you.
Post a comment, and you might get an answer, either from myself or from the readers of this blog. Otherwise: the answer is always ‘42‘ 😉
For feature requests or bug reports on the McuOnEclipse project end Processor Expert components, you should use the GitHub issue tracking system:
- McuOnEclipse Processor Expert components: https://github.com/ErichStyger/McuOnEclipse_PEx/issues
- McuOneEclipse example projects: https://github.com/ErichStyger/mcuoneclipse/issues
Related to saving space (on Flash space staved micros)…
Using Eclipse and ARM gcc (on an STM32 chip, but that doesn’t affect this), I was getting close to the 256K size of the chip and getting worried. I discovered the gcc -ffunction-sections compiler switch. This causes every function to be emitted its own linker section. Then the linker switch -Xlinker –gc-sections tells the linker to throw away unreferenced sections.
The ST I/O library I was using has a large number of functions, most of which I didn’t use. But calling just one function for a particular peripheral pulls in the entire section and all functions for that peripheral. Since that library is supplied in source code form, adding these switches reduced the code size of my project from 239K to 186K.
Related to this I searched on Google for a decent way or tools to do static analysis of my code to see what functions might not every be called, and I found really nothing suitable (that is free).
I have a lot of functions called through pointers and stuff like that, which confused all the simpler tricks with scripts parsing the map file, or ‘nm’ output.
Bill
LikeLike
Hi Bill,
yes, the GNU linker is not very good in removing unused functions by default. Without placing each function in its own section (as you did with your options) it will not be able to strip off unreferenced objects. I don’t know the details why, but looks to me a problem with the current design of the GNU linker (and compiler?).
As for static analysis: unfortunately most are for Java (http://codedependents.com/2009/07/01/top-5-static-analysis-plugins-for-eclipse/), and few if any for C/C++. Eclipse has the built in Dependency browser, but this is an interactive thing (and not for generating a report).
Another path is to use PC-lint (https://mcuoneclipse.com/2012/04/01/eclipse-and-pc-lint-linticator/), but this is not for free.
The good news is that CDT is adding some static analysis support (https://mcuoneclipse.com/2013/01/06/free-static-code-analysis-with-eclipse/) recently (http://wiki.eclipse.org/CDT/designs/StaticAnalysis).
Erich
LikeLike
I’m wondering if you ever use the Eclipse feature to install its own updates? I am using Eclipse Juno Service Release 1, from 2012. Eclipse for C/C++ and GDB Hardware Debugger both show up with much newer versions in the Check For Updates.
I’d hate to find out the hard way something breaks.
Eclipse doesn’t really “install” anything in the intrusive Windows sense, correct? Nothing in the registry or in some directory that’s non-obvious. So I could make a copy of the entire Eclipse directory tree as a backup, and if things don’t go well, just copy that back.
LikeLike
Hi Bill,
never did that with CodeWarrior, because this would easily end up in a problem as CodeWarrior has its own Eclipse and CDT extensions. But would be doable for stock Eclipse. And yes: I’m not aware of any registry/etc settings, so if you make a copy of the layout, you have a backup you can revert to.
Erich
LikeLike
Eclipse CDT, in the Project Explorer, under a project, it shows a special folder called “Includes”. Expanding that it shows the directories for #include. Both ones I’ve specified in the project’s properties and the system ones for gcc.
I changed gcc toolchains at some point. (I’m don’t remember how I did this. I combination of properties GUI, vi on the .project files, and changing the Windows/DOS search PATH) Now this Includes folder shows both the old ones and the new ones. I can’t figure out how to get rid of the old ones.
Running a grep on the entire Eclipse workspace I find the old paths inside files with names like this:
.metadata/.plugins/org.eclipse.cdt.make.core/.sc
With contents:
Somehow I think Eclipse thinks there are two toolchains “installed”.
I have no idea where that’s controlled.
Thanks, Bill
LikeLike
I found this:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=206372
[Scanner Discovery] Include path discovery doesn’t discard obsolete paths on compiler upgrade
LikeLike
Webinar – Learn how to use the latest Freescale Xtrinsic MEMs sensors with the new low cost sensor development kit from element14.
http://www.element14.com/community/events/3764
Vandana Lokeshwar will discuss element14’s low-cost evaluation kit (XTRINSIC-SENSORS-EVK ) using Freescale’s Freedom platform (FRDM-KL25Z ). You will learn how to use this platform to evaluate sensors quickly and with ease for collecting data. Measure pressure, altitude, temperature, magnetic fields, location and motion on a single board using the latest sensing technologies from Freescale.
LikeLike
Hi Erich,
Since you have a lot of expereience in working with Freedom board (KL25), I have a small question. While implementing (custom) USB CDC for the Freedom board (KL25), I am seeing that the ping pong buffers are never toggled i,e I am always observing the EVEN buffers are used (for all the endpoints I am using). Why is that so? Am I missing some thing in the configuration? Or am I not doing some thing enough to activate the ping pong?
Regards,
Pandian
LikeLike
Hi Pandian,
not sure which ping pong buffers you mean? Can you provide some details?
Erich
LikeLike
Hi Erich,
I am referring to the Even/Odd buffers used in BDT. I am seeing the ODD bit never set in the USBx_STAT register.
Regards,
Pandian
LikeLike
Hi Pandian,
I have no idea why. Maybe you should post this question in the Freescale forum?
LikeLike
Hi Erich,
Yes, I have already posted it. No responses yet :(. But by any chance have you observed this during your developments?
Regards,
Pandian.
LikeLike
Hi Pandian,
no, I have not observed this, but I have not paid attention to this neither. My understanding is that using the even/odd buffers would increase performance. Is this what you are looking for?
LikeLike
Hi Erich,
Yes, I want to achieve a higher throughput. Is it possible for you to test that (if you have free time available for this) please?
LikeLike
Hi Pandian,
for sure I won’t have time until the week after next as my schedule is more than cracy for next week. But what should I test? I mean if you say that the other buffer is not used, then I believe this. The question is more: how to fix/change this? This is more something for Freescale I think. Apart of this: I’m looking into adopting the LUFA open source USB stack. But not much time yet neither on this. 😦
LikeLike
Hi Erich,
I just wanted to me make sure that I am not missing some thing in my configuration. Any how I have raised the issue with Freescale. Will update you the status once I have some thing.
LikeLike
KINETIS MCU: WATCHDOG AND AD CONVERSION SIMULTANEOUSLY… FAILURE?!
I have tried to debug on CW MCU 10.4 a small test program over an FRDM-KL46Z board.
Few components implemented:
– AD converter on PTE22 (light sensor), on V_refsh and TempSensor (to monitor the stability of measures),
– RTI every 10ms to start the AD conversions periodically,
– WAIT utilities (tnx Erich..) to handle main loop in main function,
– some BitIO and PWM to lamp leds on PTE29 (red) and PTD5 (green)
Results:
if WDog enabled and asyncronously cleared with ad-calibration and measurements active, also with average of 128 conversions, the values of AD entities (Vrefh included), fluctuate dramatically.
Aborting WDog_Clear during calibration and/or measures of AD subsystem (by means of a flag sw), the analog values remain stables as without WDog enabled… possible?
LikeLike
Not sure if I understand? Are you saying that kicking the watchdog in your application does impact the voltage of a pin measured? That would be really strange.
LikeLike
I dont know, Erich, if that impact the voltage of a pin… likely not, also because if you monitor with on line debug the ad-channel Vrefh and TempSensor, you will confirm this deep fluctuations, but attention… is necessary to kick the wathdog WHILE ad-calibratio/conversion in progress, therefore with interrupt enabled on ad-conversion and with the main program that kick the watchdog during ad-conv… if you want, i can send you my small demo program. My work around is to set a ram status flag, that signal to main program the ad-conv in progress to avoid kick wdog… not elegant, but effective.
LikeLike
CW MCU 10.4 (10.5) BitIO COMPONENT: WE HAVE LOST Pull-Up/Down PROPERTIES?
LikeLike
Hi Antonio,
it is in a different place (Init_GPIO). See
I hope this helps?
LikeLike
Only one word… Wonderful!
Thanks Erich.
LikeLike
BTW, there is only one pin on the KL25Z that can be configured as pull down. I lost at least two days of my life because that was not made clear in the documentation.
LikeLike
Hi Injun,
intersting finding, indeed. I always used pull-ups in my designs, so I have paid attention that pull-downs are very limited.
LikeLike
Hi Erich,
I am trying to figure out how to send and receive data via Bluetooth from my program on the KL46Z. I have the JY-MCU HC-06 from dx.com.
I have read and reread your two Bluetooth tutorials on MCUONECLIPSE.COM. It appears to me that you are setting up the KL25Z as a remote terminal running RTOS that just sends back what it receives.
I don’t know if using an RTOS is best in my situation.
In my application, I am merely running a loop on the MCU that reads several input pins on the KL46Z, sends the data out the USB, listens for commands coming from the USB, and then sets various outputs accordingly.
(I tried to keep the program simple because there will be non-programmers that will maintain and troubleshoot the production device. I wonder if using an RTOS will make things more complicated than necessary.)
That being said, I am at a loss as to how to connect Bluetooth to my KL46Z. (The MCU will use BT to communicate to my UI on an Android tablet.)
I assume I can connect one of the UARTs to the BT module. Is that correct? Also, can I use UART0, or is that dedicated to the debugging port? If so, what is involved in using UART1?
If I need to use an RTOS, how would I send and receive data from within my program through the RTOS to the BT device?
I know these questions are beyond the scope of your blog, but can you direct me to where I can find the answers?
Thanks again.
LikeLike
Hi Injun,
an RTOS simplifies a lot of things, and makes the application scalable. That’s why I use typically an RTOS: to be able to build up something more capable. But in your case no RTOS is needed, if you just want to run a ‘main loop’ kind of thing. From the KL46Z point of view, the HC-06 is like a normal serial port: send and receive data from there. So yes: you need to connect one of the UARTs of your KL46Z to the Bluetooth module. Just make sure you connect the Tx of the KL46Z to the Rx of the module. You can use either UART0 or UART1, does not matter.
I hope this helps.
LikeLike
Thank you. That helps a lot … really!
LikeLike
ok, good and glad to hear this 🙂
LikeLike
I got it. Thanks Erich.
LikeLike
Hi Erich!
I love to read your articles! Day by day your posts have something new, innovative and also interesting. Congrats!
Because you have more experience then me with embedded systems and as I can see with Freescale silicons, I want to ask you for an opinion / suggestion. I want to make a voice controlled robot car – something simple. I am beginner into digital signal processing field, but I am ready to learn new things. For doing this, I am prepared to buy a Freescale development board, but I do not know which. I am afraid that processing power will not be enough, even if I will implement simple algorithms for signal processing. Could you give me an advice related with my fear? For example, can I use a Freedom board, like KL46Z? What kind of board would you advise me to use?
I forgot to mention that I want something ultra-low-power, which will be battery powered. If you want more details please tell me.
Thank you.
LikeLike
Hi Mihai,
many thanks for your feedback: always good to hear that things are useful if posted to the Wild-Wild-Web 🙂
I have to admit, I have not done any speach recognition work. My thinking is that it all depends on the complexity and the commands: if it is about just to process some simple things, I think a KL46Z (FRDM-KL46Z) could be a starting point. But I think you problably need more horsepower, so better consider the FRDM-K20 (this one has a Cortex-M4 and is more capable).
But my thinking is that your algorithm might need some amount of RAM, and here you could run against a wall: my guess is that you need at least 64 KByte RAM, if not 128 and more. Because you probaly need to record the signals, and then do processing on it, so you need to store it. But larger RAM and higher processing speed does not go well with low power.
Again, it all depends on the complexity of things you want to do.
I hope this helps.
LikeLike
Knowing nothing about DSP, I expect it to be software intensive, therefore, hard to develop with no prior experience. You might look into finding a “front end” that will do the actual speech processing for you. For instance, perhaps a speech recognition program for an Android tablet could be used to register the commands, and then the tablet USB or Bluetooth be used for the external control you seek.
FWIW, this morning I learned about a voice recognizing operating system that may work for something along the lines you are investigating.
http://thehackernews.com/2013/09/jarvis-artificial-intelligence.html
LikeLike
You might also start by creating your system without voice recognition, and then add it later when you find exactly what you want.
LikeLike
Thanks for your replies, guys! I am going to create my system without voice recognition, and after that I am going to try to add voice recognition. Maybe a solution will be to have two or more boards. I will see.
Thanks again.
LikeLike
Hello, I’m newbie in embedded software world I’m a .Net guy with that being said here is my question. I’m playing with FRDM-K20D50M board, according to board’s manual target MCU works in SWD debug mode and Processor Expert reserves for that mode pins: PTA0(#22), PTA2(#24), PTA3(#25), also according to board manual on-board Blue Cathode uses PTA2. Does that mean that I will not be able debug any application that uses PTA2.
If my question is totally stupid, any point to the right direction will be greatly appreciated.
Thank you in advance,
Maxim.
LikeLike
You are able to debug that board even with PTA2 used by the application. SWD uses a reduced set of debug pins.
LikeLike
Hi Erich,
I have simple question that I don’t know where to find the answer to. I have an Android tablet connected via USB to a FRDM KL46Z. How do I determine in the KL46Z when it loses the USB connection? I want to turn all outputs off at that point.
Under the USB component in Proc Exp I see the OnError method but I don’t know how to use that to do anything in my ProcessorExpert.c program. I gather I am to add code under that method in Events.c but I don’t know how to do add code there that I can use in my ProcessorExpert.c program.
Or, if I am to use USB1_OnError some other way.
Once again,thanks for your help.
LikeLike
This is what I use in my examples to find out if I still have a connection:
while(CDC1_App_Task(cdc_buffer, sizeof(cdc_buffer))==ERR_BUSOFF) {
/* device not enumerated */
LEDR_Neg(); LEDG_Off();
WAIT1_Waitms(10);
}
If it returns ERR_BUSOFF, then the enumeration did not happen (yet) or device has been disconnected.
But in my experience that method did not work on all devices or in all cases, not sure why.
You might give it a try this way.
LikeLike
Thank you for your suggestions, Erich. I am using that code to establish the initial connection. I tried also putting it in an if statement to see if it would fire upon losing the connection, but I could not figure out how to make it work in my situation.
I tried using the USB1_OnError method in the Events.c file. I put an “extern” variable in a header file and I set the variable in the USB1_OnError method. I can then read the variable in my ProcessorExpert.c file and turn off the outputs accordingly, BUT, I don’t know under what conditions USB1_OnError is called by the internal MCU programming. It does not appear to be called when the USB cable is disconnected.
When the USB cable is unplugged, my MCU program appears to hang. I don’t know if an error is being generated at that point, or if the program is just waiting for a read or write function to complete.
Do you have any suggestions about how I can turn off the outputs when the USB cable is disconnected, or when there are any other USB disconnect issues?
If not, do you where I might find find the answers to these questions?
Thank you once again for you kind assistance.
LikeLike
My project on GitHub (https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples/FRDM-KL46Z/FRDM-KL46Z48M_USB_CDC) detects if I disconnect the cable or not. Maybe Android is doing something different? Can you try this project if it works say with Windows 7 (this is what I use).
You could search for USB1_OnError() in your sources. I have added this really as a starting point for error conditions. And it is called only right now in case the CDC1_Init() fails. So it is not usable to detect disconnect of the cable.
But CDC1_App_Task(cdc_buffer, sizeof(cdc_buffer))==ERR_BUSOFF works for me.
LikeLike
Dear Erich,
I used your “mcuoneclipse / Examples / TWR-K70F120M / TWR-K70F120M_USB_CDC” sample code. And I found while(CDC1_App_Task(cdc_buffer, sizeof(cdc_buffer))==ERR_BUSOFF) {
/* device not enumerated */
LEDR_Neg(); LEDG_Off();
WAIT1_Waitms(10);
}
won’t return ERR_BUSOFF when the TWR_K70 is disconnected to PC.
But KL25 and KL26 will.
Do you know how to reslove this issue?
LikeLike
I have seen this too, but not seen an easy solution. I believe it is because the K70 has a different USB block, and it reacts differently.
LikeLike
Dear Erich,
Is K20 the same as K70?
Because mine is.
Thanks.
BR,
Sean
LikeLike
Hi Sen,
the K70 has a different USB peripheral than the K20.
LikeLike
Dear Erich,
In K70, I found when disconnected USB, event_type in CDC1_App_Callback will be USB_APP_BUS_SUSPEND in most time, and sometimes will be USB_APP_BUS_RESET.
LikeLike
Thank you for your suggestions, Erich.
Your program works as expected on my Win XP system. Also, I tried a KL46Z with your program connected to my Android tablet and the LEDs indicated correctly when the cable was unplugged, and then reconnected. Ditto Ubuntu 12.04 and Win XP on VirtualBox on Ubuntu.
(It seems though, that even though the LED indicates the USB is reconnected the MCU no longer communicates with the terminal program.)
I have spent a great deal of time the last three days trying to figure this problem out. I probably tried a few hundred combinations of different code sequences to duplicate or cure the problem in both your program and mine.
THE PROBLEM is that in order for the LEDs to indicate connect/disconnect status, the writing statement (such as CDC1_Send_Block or CDC1_Send_String) has to be inside the if(CDC1_GetCharsInRxBuf()!=0){…} statement.
I don’t understand why this is but it is consistent.
In my program I have been writing to the USB at a point different from where I was reading from it. My USB reading and writing seemed to work fine for everything but this stupid USB disconnect issue.
Now, at least, I know how to make the LEDs work right, even if it doesn’t actually reestablish communication. I think I can do that from my Android tablet.
Thanks for your help.
LikeLike
Not sure if I understand the problem? You say it works correctly with XP and Ubuntu, but not with Android, right?
And that CDC_Send_Block() and CDC_Send_String() only are working correctly if there are incoming characters?
LikeLike
I apologize for not being more clear.
I tried to say that with Android (or Ubuntu, etc.), the LEDs in your program act as expected. However, they only work as expected if the write statement is inside the “if” statement.
Also, even though the LEDs in your program indicate USB re-connection, data can no longer be transfered between the terminal program on WIN XP and the MCU. (At least, in my experience. Perhaps I got something wrong in this?)
I also tried to share that (except for this LED lighting issue) I have been able to read or write wherever I wanted to in my program.
My next step is to determine if I can use this new understanding to turn the outputs off upon USB disconnection.
Sorry for the mix up.
LikeLike
no worries. About the LEDs: I just have fixed the LED handling for the FRDM-K20 as they were not properly showing the status. I have not checked the other examples, so it could be that the LEDs are not correcly reflecting the status (connected or not). Maybe this is where the confusion comes from.
LikeLike
Hi Again,
I am still struggling to understand your FRDM-KL46Z48M_USB_CDC program. It seems that when the cable is disconnected and reconnected, the statement if(CDC1_GetCharsInRxBuf()!=0) is never again true.
This seems why, even though the LED comes back on, one cannot write to the terminal program again.
CDC1_GetCharsInRxBuf() is defined in CDC1.c where it calls CDC1_App_Task(txBuf, sizeof(txBuf))!=ERR_OK).
(Forgive my ignorance, but does it matter whether txBuf or rxBuf is used in this instance?)
(Interestingly, I changed the statement to CDC1_App_Task(txBuf, sizeof(txBuf))==ERR_OK) and it made no difference in how the program operated. I don’t know if that is significant or not.)
I have been unable to figure out how to get CDC1_GetCharsInRxBuf() to read from the USB upon cable disconnection and reconnection. May I trouble you once again for suggestions? Thank you.
LikeLike
Are you unplugging the cable while the Android is sending data and the COM port open? Maybe this is the source of the problem?
Sounds like a similar issue on Windows.
And: you need two separate buffers: tx and rx. They need to be distinct, as there there are two streams of data in parallel. CDC1_App_Task() needs a buffer for the data transfer, it could be any buffer. If you swap tx and rx, that’s fine. But you cannot use the same buffer for sending and receiving.
CDC1_GetCharsInRxBuf() simply checkes if there is something in the incoming buffer. Things are put into the incoming buffer by an interrupt (the USB interrupt). I really don’t know what is going wrong on your end. The fact that it only happens on Android let me believe it is an Android issue. What happens if you close the connection on the Android side before unplugging the cable?
LikeLike
I’m apologize. I wasn’t very clear again.
It is not just happening in Android. My last post was exclusively about trying to get your program working with WIN XP on a standard XP machine.
The tx and rx buffer issue was from your example program.
Sorry for the confusion.
I will try adding rx buffers to your program and see if that makes a difference.
Thanks for the quick response.
LikeLike
Unfortunately I do not have any XP machines available any more, as they have been phased out long time ago :-(.
LikeLike
P.S. The suspicious code is in the CDC1.c file in the Generated_Code folder which is generated by CW. (This is in your FRDM-KL46Z48M_USB_CDC program when running on a Win XP machine.) Where does that come from, please?
Thank you.
LikeLike
CDC1_App_Task() needs a buffer for sending the data. That’s why CDC1_GetCharsInRxBuf() is passing a ‘txBuf’ to CDC1_App_Task(). But this buffer is a static local.
I still do not understand what the problem is on XP: CDC1_GetCharsInRxBuf() calls CDC1_App_Task() because this will make sure that the current outgoing buffer is sent, and new items are received from the input pipe.
Is your problem that CDC1_GetCharsInRxBuf() blocks? There is a timeout which can be used for this.
LikeLike
FYI, I have updated the KL46Z project on GitHub so it using a timeout now. Maybe this solves the problem you have?
The commit is this one:
https://github.com/ErichStyger/mcuoneclipse/commit/1c875ccca2bbdd68b657ad1e1de34f205365f376
LikeLike
Thank you for taking the time to update your program in order to address this issue. I tried it in the KL46Z connected to my Win XP machine and the MCU still did not reconnect to the terminal program (Termite 2.9).
With your program in the FRDM-KL46Z communicating with the terminal program on your Win 7 system, if you disconnect the MCU USB cable and reconnect it, are you able to still communicate with the terminal program running in Win 7?
The MCU LEDs will show a reconnection, but does the terminal window show the returned echo and val number in response to keys typed on the keyboard?
This is where my problem lies. The MCU will not reconnect to Termite 2.9 in Win XP even though the LEDs on the MCU show it is connected.
If your MCU program reconnects to the terminal program in Win 7 then the issue is with my XP machine. If it does not reconnect, then I will try to understand more about how your program and the KL46Z handle the USB disconnect and reconnect process.
Thank you for your time once again.
LikeLike
No, if I disconnect the cable with an open (connected) terminal progam on the host and plug it in again, the communication does not work. To my knowledge this is a Windows issue. You need to close the terminal connection on the host before you re-connect the cable. So with this, you need to detect on your android device that the cable is disconnected, then close the port, and only open it again once the cable is connected.
I have the same issue with Windows 7, and it exists as well in Windows 8 to my knowledge.
LikeLike
Thank you very much for checking that out for me, Erich. That answers a lot of questions for me.
My problem has been to get the KL46Z to recognize it has lost USB connection (in Windows or Android) and turn off its outputs. (Hopefully, I can then program it to reconnect to the USB without a manual CPU reset.)
I suspect that anyone who wants to use this FRDM board with any kind of USB interface to another program (no matter what OS is running on the hardware) will also want this capability.
[I can imagine a factory (or a very large machine) having a number of these little FRDM-KL46Z boards controlling various operations in different places. They could all be connected to a central computer (Windows or LINUX) which records data and makes processing decisions which are then sent back to the KL46Z boards. In this context, it would be helpful for the KL46Z to not freeze when it loses USB connection.]
[This is essentially what I have done, but with only one remote KL46Z in a machine the size of a narrow workbench. We have a prototype going to various shows around the U.S. and it is embarrassing to the salesman demonstrating to a potential customer when there is a glitch in the USB connection and the machine keeps running out of control when it is supposed to stop. This is why I need the MCU to at least turn off the outputs when it loses USB connection.]
Thank you for all of your time and help on this troublesome KL46Z issue.
LikeLike
Is there a bug in codewarrior 10.x ?
If chose RAM mode in K70 PE project, in the .ld file, __S_romp = 0 defined,
and in __arm_start.c __thumb_startup(), these is a
if (__S_romp != 0L)
__copy_rom_sections_to_ram();
if this true, there will be no code and data copied to ram at system start.
Or there is something else we can ignore this ?
LikeLike
.ld file explained this, all the code burned into the data_flash area, so there will be no need to copy, all the code and data will run where they are locally ?
LikeLike
Yes, while downloading the code to the target, the debugger stores it in RAM. So if you turn off the power, your program is lost. That’s whay these ‘RAM’ targets do not make sense to me (I always use the FLASH targets, because this is what is needed at the end).
LikeLike
I’m not using the RAM configuration as this is not useful for me. But to my undestanding the code gets downloaded by the debugger into RAM, and there is no copy from flash to RAM.
__copy_rom_sections_to_ram() is use to initialize RAM variables with content from ROM (the constants), e.g. for
int i = 3;
where i is in RAM and 3 is in FLASH/ROM.
LikeLike
Hi,
I am trying to work out what is going on in the following:
#define EnterCritical() \
do {\
if (++SR_lock == 1u) {\
/*lint -save -e586 -e950 Disable MISRA rule (2.1,1.1) checking. */\
asm ( \
“MRS R0, FAULTMASK\n\t” \
“CPSID f\n\t” \
“STRB R0, %[output]” \
: [output] “=m” (SR_reg)\
:: “r0”);\
/*lint -restore Enable MISRA rule (2.1,1.1) checking. */\
}\
} while(0)
I understand the the asm(“”:::) is using the GCC Extended asm commands.
I understand that the “MRS R0, FAULTMASK” – Reads the FAULTMASK into R0
and that “CPSID F” disables the interrupts by clearing the FAULTMASK
and that “STRB R0, %[output]” stores the saved FAULTMAK into the variable SR_Reg
What i don’t understand is the “R0” what is this doing??? From the GCC manual the third optional item is the “list of clobbered registers” but what are these and how does the While loop ever exit if it is in a while(0) loop??
Thanks for you help,
LikeLike
‘Clobbered’ means that registers are touched/changed. With this, gcc compiler knows which registers are changed inside the assembly block (without knowing the details), so gcc can save/restore registers as needed.
The while loop is an ‘artifical’ one so it creates a new code block. It only gets executed once because the while(0) at the end. I hope this makes sense now?
LikeLike
Hi,
I have been playing with the WAIT library using a GPIO Pin to test the timing accuracy.
i ended up changing the ms function to the following :
void WAIT1_Waitms(word ms)
{
dword msCycles; /* cycles for 1 ms */
/* static clock/speed configuration */
msCycles = WAIT1_NofCyclesMs(1, CPU_CORE_CLK_HZ) – 17600;
while(ms>0) {
WAIT1_WaitLongCycles(msCycles);
ms–;
}
}
When i specify a delay of 300ms using the unmodified code i was getting = 462.8ms
But with the modified code (i.e. -17600) i am not getting = 300.12ms
NOTE: I am using a MK10 CPU and the
Core Clock = 50MHz
Bus Clock = 50Mhz
External bus = 50Mhz
Flash clock = 25MHz
Could the -17600 be fixing the function as it take into account the while loop overhead, or is it possibly due to the Flash Clock??
Any ideas??
LikeLike
Such a ‘busy-wait’ never is very accurate, but my experience is that it is in the +/-10% range.
I just run a 300 ms wait on the KL25Z:
for(;;) {
Bit1_NegVal();
WAIT1_Waitms(300);
}
I measured 328 ms signal toggling (20.9 MHz core clock, 20.9 MHz bus clock), and I use the CPU_CORE_CLK_HZ as my timing base.
I changed the bus clock to 10 MHz, and things stayed the same.
The L family has no Flash clock, I’ll try with my K20 and let you know.
LikeLike
I tried that wait for 300 ms on my K20 (20.9 MHz cor, 20.9 bus clock, 10.45 external bus clock and 10.48 MHz flash clock), and I get 338 ms.
Could it be that you use an old version of Wait component? I know that I had fixed something a while back.
The current version is
** Version : Component 01.064, Driver 01.00, CPU db: 3.00.000
LikeLike
Hi Erich,
I’m porting a library to the KL46Z and it makes use of the C standard sys/types.h header file. However, mingw32-make is telling me that there is “No such file or directory” when I try to build the project. I know that sys/types.h exists on my ARM GNU installation files and it has the following path:
“C:\Program Files (x86)\GNU Tools ARM Embedded\4.7 2013q2\arm-none-eabi\include\sys\types.h”
In addition, my project’s “Paths and Symbols” settings include the entry:
${ARM_GNU_TOOLS_HOME}/arm-none-eabi/include
This path is included by default when I create Processor Expert bareboard projects.
Additional info:
If I edit the code to remove the “sys/” part and leave just #include then the compiler doesn’t complain. This concerns me since “types.h” does not exist within the “…/arm-none-eabi/include” root folder for the standard C headers. It exists within the “…/include/sys” folder.
Is it ok to just remove the “sys/” part? If so, then why is this allowed and why does the compiler complain when I add back the “sys/” part? The library I’m porting over was written in ANSI C. At least that’s what the manufacturer says 😉
Many thanks in advance and have a good weekend!
LikeLike
“Paths and Symbols” is only for the indexer. The compiler uses the paths in “C/C++ Build/Settings/Arm blah blah compiler/Directories. Try adding “${ARM_GNU_TOOLS_HOME}/arm-none-eabi/include” there, it should work (just ran into this myself, found your post, and tried it, worked for me…)
LikeLike
How to read the 80bit chip id from kl25 or kl46 chip?
LikeLike
Hi,
I just posted an article how I read the UID. Have a look here: https://mcuoneclipse.com/2013/11/30/kinetis-unique-identification-register/
LikeLike
There is a problem in KEY or Trigger comp, when add two or more KEYs to the proj, with using one TRIGGER , in the TRG1.h file there should be something like
“#define KEY_***_Press 0”
“#define KEY_***_Press 1”
….
Otherwise , there is a complie error.
LikeLike
Unfortunately, the trigger component does not know anything about the Key module. Because I usually have at least one key, the trigger component has one trigger already defined for one key. If you are using more than one key, you need to add it to the trigger component. In the trigger component properties, you can add and extend the list of triggers. Maybe I will find a way to do this automatically, but I think it is not possible (or not easily possible). So I recommend that you add it by hand. Sorry about this.
LikeLike
How to enable dsp instructions in freedom-k20d board using codewarrior 10.5?
LikeLike
Hi Kevin,
to my knowledge GNU gcc does not generate the DSP instructions directly. Best way is to use it with the ARM CMSIS DSP library (https://mcuoneclipse.com/2013/02/14/tutorial-using-the-arm-cmsis-library/).
LikeLike
Hi Erich,
I appreciate all the help that you are doing for us.
I have a small question. I am using freescale K60 module (CW 10.1.2 IDE with PE). I am running my application in that and I am facing some issues in between. Now, I want to attach my debugger and check the variables in the application.
Can we do this kind of run time debugging with CW IDE?
If so, please let me know how this can be done?
Thanks,
Jagadeesh.
LikeLike
Yes, it is possible to attach the debugger to a running target, see https://mcuoneclipse.com/2012/10/10/attach-connect-download/
Additionally FreeMaster (https://mcuoneclipse.com/2013/08/24/tutorial-freemaster-visualization-and-run-time-debugging/) can be used to monitor values while the target is running without the debugger.
LikeLike
Hi Erich,
Its wonderful to learn embedded systems after following your site. Thanks for all. I have a problem using debugger (Jlink Lite) with my target, K60F Tower board, and learning USB with it. I am using your tutorial for setting up the Eclipse based environment along with GCC and Processor Expert. Unfortunately there is always a hard fault exception in the /Project_Settings/Startup_Code/startup.c file which has function __copy_rom_sections_to_ram();
I believe you have not used GCC but CodeWarrior for your development. Is there any way i can continue my debugging?
LikeLike
Hi!
I’m using a mixture of different tools, CodeWarrior one of it. But I’m using ARM GNU gcc with CodeWarrior too. Your hardfault sounds like something is not correctly initialized by the startup code. For example using a RTC which is not properly clocked might cause a hard fault, among other things. If it happens during the ROM to RAM copy part, it could be that your memory and bus clocks are not properly set up. I suggest that you try a project set up by CodeWarrior as my experience these projects set up everything correctly. If you are using ad different tool chain, you still could copy then this code to your own (e.g. bare GCC) environment.
I hope this helps.
LikeLike
Hi Erich.
I am getting a similar problem on one of my projects. I am coding in Codewarrior 10.5 using GCC.
I am saving bitmaps as arrays in my flash on the micro, as I am using a MK40DX256 device I have plenty memory.
What I find is if my firmware gets larger than 128K I get this problem, even though It compiles fine etc?
Do you have any idea what could be causing this?
LikeLike
could it be that it just takes too long and the watchdog triggers? The other thought is: the copy-rom-to-ram is for things like
int var[] = {3,5,5};
so it copies from ROM the constant valuse (3,5,5) and places it into RAM (at the address of var[]). this can take along time. Do you have something like this?
It would be better to use
const int var[] = {3,5,5};
if possible?
LikeLike
Hi Erich.
I am using:
const unsigned char Arial_Bitmap_Data[] = {x,x,x,x};
I did this as the size of the bitmap is larger than the available ram on the device.
I will investigate the watchdog issue although I am not using it at the moment. This one does have me stumped, I am willing to pass code onto anyone who may know what is causing it.
I cannot see what data is being moved to the RAM in the debugger view, I can see them normally once the micro has started up though in a smaller program.
LikeLike
So you have it as ‘const’, that looks ok. So I think you need to single step through your code to find out where exactly (for what data/address) the problem occurs. Check the destination address, and consult the linker map to find out what variable/object is causing this.
LikeLike
Hello Erich,
You have a really great blog here. I was searching to find out the difference between hc-05, and 06 and you explained things so nicely. Thank you.
My ultimate question is which Bluetooth module I should use for the product that I am working on. It is a wireless light control system. I am going to make a smartphone application to control two things. One is the ballast for the lighting, and the other one is wall controller that is connected to one or more lighting. Of course, I am thinking about WiFi also, but I am going to deal with Bluetooth first.
So far, I have decided that the module should be wide range. I am thinking about class 1 or 2. Since it is a lighting system, it really need to be reliable and low cost at the same time 🙂 I need a lot of it, so I think I can get some discount.
If you answer my question, I will really really appreciate it.
Thank you.
LikeLike
Hi Tae,
thanks for you nice comment :-).
About your question: my honest answer is that you probably should not use Bluetooth for something like this. It depends about the details of this product, but I rather would recommend that you use something like ZigBee or IEEE802.15.4 instead. Or your own proprietary protocol. There are simply to much problems with such a thing and using Bluetooth. Bluetooth is fine for standard components (audio, headset, serial connection), but without the right expertise creating your own class will not be easy. Using a simple web server/wifi is would consider too. But then it all depends on how low power your application has to be. And if it is about lamp control: have a look at established protocols like DALI.
I hope this helps.
LikeLike
But if you want to control from a cell phone Bluetooth may be the only universally available protocol.
LikeLike
If you are going to use Bluetooth, then you heavily depend on the device class and support implemented. That’s fine for generic classes like ‘headset’. But for example look at the iPhone Bluetooth stack: it is not possible to make a connection as a Bluetooth-to-Serial class. Even more, it is pretty much a 1 to 1 connection. So if you are really looking for a universal protocol, then I suggest to go for a HTML server (TCP/IP): that way you do not need a special application or driver on the phone: all what you need is a web browser which should be available always. Of course I’m talking here about smart phones. If you intend to connect to non-smart phones (like the old Nokia phones/etc), then that would be a different discussion?
LikeLike
It may be better to use WiFi rather than Bluetooth with portable devices, but Bluetooth Low Energy is changing the picture:
LikeLike
Yes, agreed. But here is exactly what I tried to say: “don’t use Bluetooth”: Becaues Bluetooth is *not* Bluetooth Low Energy (BLE). The only common thing between Bluetooth and BLE is that a) it shares the name b) it uses 2.4 GHz and c) it is a wireless protocol. You cannot use a Bluetooth module to talk to BLE 😉
LikeLike
Got it. There are now some BLE modules available, and some one-chip solutions that have a BLE module and ARM processor on a single chip (the antenna and balun are off-chip).
LikeLike
Yes, I have seen such modules too, but had not had a chance to have my hands on them.
LikeLike
Thank you for this great discussion. Very useful information. I am still deciding whether I should start over the project to have Zigbee and WiFi with own router, or to continue with BLT. I think using BLT on a couple of lights would be better, because it is so simple to connect. As you said, to have a universal system, Zigbee or WiFi is the way to go. From my knowledge, BLE can have maximum 7 slaves. Doesn’t it mean that I can control all seven of lighting at once with my smartphone?
Thank you
Tae
LikeLike
If you can have 7 slave (nodes) with BLE, then you should be able to controll all of them with your master node. Looks like similar to what I can do with the Nordic Semiconductor nRF24L01+. Yes, this is not Bluetooth, but it looks a lot of the ideas of the nRF24L01+ made it into the BLE.
LikeLike
Just to be clear. Aren’t all versions of BT can have 7 slaves and master can control them at once? I thought they were designed that way.
LikeLike
Yes, I believe so.
LikeLike
Well, It’s been a great help, thank you guys! Thank you Erich! http://youtu.be/SynyKRkbLh8 There is this great video showing the difference between BT2.0+ERD and BLE.
I will keep in touch.
Thank you
Tae
LikeLike
There might be a little porblem in KEY component, please follow blow link to see snap screen,
Thanks.
http://user.qzone.qq.com/168877513/4
LikeLike
In the “Web” folder.
LikeLike
Hi Kevin,
I have used your link, and tried it with the ‘Web’ added to the link, but I have not seen an image/screenshot. Can you describe your problem or post a new link?
LikeLike
sorry for the mistake, updated link blow
http://user.qzone.qq.com/168877513/photo/V11KRLUb0fTzBU
LikeLike
If close the project and reopen it, the problem fixed itself
LikeLike
Hi Kevin,
ok, I see. Glad to see that it works now. But I had the same issue sometimes too. Somehow sometimes Processor Expert gets stuck that way. Closing and re-opening the project usually helps.
LikeLike
Hello Erich!
I’m very thankful for stumbling into your blog! As I was searching for jump-start tutorials on the KL25Z board. Right now I’m making a real time clock using the RTC_LDD based on this tutorial freescale community DOC-94734 but the rtc is off as much as 2 sec per 30 min and is the only module running on the 48MHz core. Is there any way to make it to 1 sec/day or less?
Thanks.
LikeLike
Hi Micheal,
glad to hear that you find it useful, thanks for that feedback!
As for the RTC: it looks like your RTC is not really 32 kHz, so slightly off maybe because of temperature. You should be able to add an offset (change the frequency) of the RTC clock input (second image on freescale community DOC-94734). Increase or decrease that 32 kHz value to compensate for the error. That way you should be able to reduce the error. This technique is called ‘trimming’ is used to deal with different clocks. For your final application you might consider to perform this by the application itself (if you have multiple boards).
I hope this helps.
LikeLike
Hello again erich, thanks for the reply. Though I cant edit the RTC clock input, there was the option to add compensation for the RTC clock input in the component inspector. I measured the RTC clock input and it was at 32.84 kHz. I experimented on the compensation settings to see how it can help me get the right frequency, but I failed, it didn’t changed anything. I still measure 32.84 kHz.
Also I turned off all other components and modules present in my application. Any thoughts on how I can use the compensation settings?
Thanks.
LikeLike
To my understanding the compensation settings only will affect the internal settings, but not the external clock frequency directly.
LikeLike
I see, I think I need more reading about the RTC on the KL25Z, Thanks for the speedy reply sir.
LikeLike
Hi Erich,
Where could be found the documentation for the components(e. g. Serial_LDD)?
Also for FRDM-KL25Z on web-site is only one App Note, I think should be at least one for each component/feature on the board.
Thanks,
Lucian.
LikeLike
Hi Lucian,
have a look here:
I hope this helps,
Erich
LikeLike
The new PE get a problem with the KEY component, don’t know is the problem of PE or KEY
component, please follow the blow link to see the snapscreen of “33” and “44”, thanks
http://user.qzone.qq.com/168877513/photo/V11KRLUb0fTzBU
LikeLike
Hello,
yes, it looks that this is a problem in Processor Expert. Can you close the project and re-open it again? This should remove the problem. Let me know.
LikeLike
I tried that, but the problem still there.
Now i have to use it in pull mode.
LikeLike
RIGHT APPROACH FOR MIGRATING FROM STM32 CMSIS style code
Hi Erich
a coworker wrote a stable and well tested code for STM32 ,now i have to reply the same structures in a CW project developed with the help of Processor Expert it would be nice if the now code could appear similar to the original one at a glance ,but I don’t pretend it.
At least it would be nice if i could have functions doing the same job,
What is your approach having to do with a code to migrate from,based on structures to fill and Init to launch :
void STM32_EXTI_CTRL_forCC1101(FunctionalState NewState)
{
EXTI_InitTypeDef EXTI_InitStructure;
/* Configure EXTI9 GDO0 line for RX mode */
EXTI_InitStructure.EXTI_Line = CC1101_FIFOTHR_IRQ_EXTI_LINE;
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising; //EXTI_Trigger_Rising, EXTI_Trigger_Falling
EXTI_InitStructure.EXTI_LineCmd = NewState;
EXTI_Init(&EXTI_InitStructure);
/*add rev for EXTI1 GDO2 line for TX e RX mode */
EXTI_InitStructure.EXTI_Line = CC1101_TRXPKT_IRQ_EXTI_LINE;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; //EXTI_Trigger_Rising, EXTI_Trigger_Falling
EXTI_Init(&EXTI_InitStructure);
}
Many tanks
LikeLike
Hi Diego,
not sure if I understand what you are asking about. As long as your STM32 code is normal C, then you should not have much troubles to port it. But maybe you problem is about the CMSIS style? Yes, this is a challenge as Freescale does not seem to provide CMSIS compliant libraries and files. This hopefully will change.
LikeLike
Thank you for your opinion, Erich
LikeLike
Hi Erich,
I am trying to read data from two foreign IMU sensors: one uses I2C protocol and the other uses SPI from the K60 Tower Board(the master device). I am aware of the “I2C_LDD” & “SPIMaster_LDD” components from ProcessorExpert, and I have no problem configuring the corresponding static settings. But I’m helplessly clueless on how to even begin with the coding parts that tell the microcontroller how to communicate with the sensors. I’m terribly sorry if I sounded frustrated, this is work related… =\
Could you guide me on how I should begin? Or point me to any tutorials that might be useful. I guess another question would be can the K60 read and output data from two sensors simultaneously?
Thank you for your time,
Dao.
LikeLike
Hi Dao,
In my experience, the *_LDD components are very hard and complicated to use. I prefer the non-LDD ones which provide a simpler and easier interface.
For SPI, have a look at these tutorial and source code:
For I2C have a look here:
And yes: there should be no problem to read data from two sensors simultaneously. You only need to take care if they are on the same bus, but otherwise I’m doing this a lot.
I hope this helps.
LikeLike
Hello Erich, right now Im using two portA pins, pta16 and pta17 as external interrupts. compiling the code produces a “redefinition Cpu_vINT_PORTA.” is it possible to use two external interrupts on the same port? Thanks.
LikeLike
Hi Michael,
yes, that should be possible in my view. Which component are you using?
Erich
LikeLike
Im using the ExtInt_LDD.
LikeLike
Can you try ‘ExtInt’?
LikeLike
Using ExInt produces the same error..
LikeLike
I quickly tried this (KL25Z), and it works for me?
PE_ISR(Cpu_ivINT_PORTA)
{
ExtIntLdd1_Interrupt(); /* Call the service routine */
ExtIntLdd2_Interrupt(); /* Call the service routine */
}
Are you using MCU10.5 with the Processor Expert Update 1.0.0?
LikeLike
I apologize for the late reply, I got it working now, thank you so much Eric.
Another issue I’m having is with the SD card. I’m currently using the PE component that you made, the FAT_FS component. I don’t know how to append files, because when I open-write-close the file and do it again, it overwrites the data on line 1. I want to append the next data on line 2. This is my first time working with SD cards so please bear with me 🙂 Thanks.
LikeLike
This is not all specific to SD cards: it applies to files on your host too. If you do not want to re-create the file, simply open it with FA_READ flag:
res=FAT1_open(file, (const char*)dataFileName, FA_READ); /* try to open file */
LikeLike
Yes, that would be the case for reading a file, but when writing again the same file for another set of data. It just overwrites the data on line 1, instead of appending it.
LikeLike
Here is an extract how to do this: you need to go to the end of the file with lseek():
static byte SDC_AppendToFile(const char *path, const char *txt) {
FAT1_FRESULT fres;
UINT nof = 0;
size_t len;
/* open file for write, create the file if it does not exist */
if ((fres=FAT1_open(&fo, (char*)path, FA_WRITE|FA_OPEN_ALWAYS)) == FR_OK) {
if ((fres=FAT1_lseek(&fo, fo.fsize)) != FR_OK || fo.fptr != fo.fsize) {
//Fatal(“lseek failed”);
return ERR_FAULT;
}
len = strlen(txt);
if ((fres=FAT1_write(&fo, txt, len, &nof)) != FR_OK) {
return ERR_FAULT;
}
LikeLike
Thank you so much for that snippet. I’m real sorry for having you to spoon feed me. I’m really grateful sir. Now I’ll modify the function to fit my needs. thanks again 🙂
LikeLike
Hi Michael, no worries, everyone needs to start somewhere, and I know how relevant example code is.
LikeLike
Hi Erich,
when i use the chLCD or KentchLCD or sharp65 driver components, there is a warning in console
:{{DEVELOPMENT}} WARNING: Component GenericSWSPI was stored in the template in newer version: 01.018>01.001
and things not going on any further just stopping at create shared component spi(0%) shown in eclipse status bar.
I’m using kepler with PE10.3, any idea where is going wrong ?
LikeLike
Hi Kevin,
I guess this is only with the debug option enabled? I will have a look today.
LikeLike
Hi Kevin,
The warning is just a warning (I have fixed it now on GitHub). The other things is indeed a Processor Expert bug. I have updated the components in the GitHub sources so they have the shared component disabled, as a workaround.
LikeLike
Hello Sir,
I am trying to program a custom board (KL04) via the Multilink.It worked fine, but then it shows the “Device is secure.Erase to unsecure”.I keep pressing Yes.
AFter doing this twice the “Multilink” not connected is shown. There was another board that was doing the same.
But, its now, surprisingly working,except this 1 board.
I tried the Processor halt utility from P&E micro. Still no luck.Uninstalled/installed PE drivers. No luck.
Also, no where in the code have I modified that register (FTFA_FOPT or any such dangerous registers:) .
Infact CODE WARRIOR warns you if you make any changes to such registers.).
Also, is there any way I can ensure such a message/error does not occur in any future boards. Can this be done via s/w code or so.
I saw in a ur blog that I can look at the Binary files at the location 0x40C. How can I look at 0x40C. Kindly help me out. This is a disaster as 1 board is beyond recovery.
Another thing that I am planning to do is inspect the intel hex file before programming it into the controller( the 0x40C frame for disable mass erase). You had mentioned you wld so that in one of your earlier posts. Can u tell me how to read an ihex file. For eg – the 1st line is “:10000000000C002025090000C9080000C9080000F4″
How do I analyse this. Thank u sir.
Vinod.
LikeLike
Hi Vinod,
I suggest you check if the clock of your board is working properly, and that the supply voltage is correct. I have seen ‘secured’ messages for all kind of things where the debugger is not able to talk to the device. Another common cause is that you programmed the wrong file in error to the board.
In the worst case, your board is lost.
As for reading hex (or other files like S19), see https://mcuoneclipse.com/2012/09/27/s-record-intel-hex-and-binary-files/
LikeLike
HI Erich,
Do you think the KL46Z FRDM board would be fast enough to handle a 320×240 color LCD display and touch panel? If not, do you have any recomendations? I need to update our equipment line and need to determine which MCU to base it upon.
Thanks again.
LikeLike
I have used the ColdFire JM128 with the TWR-LCD, and that works fine (SPI interface). I have example projects on GitHub (TWR-LCD folder). But the speed of the display refresh is not extremely high (it is ok). For higher speed, you should use a parallel interface. Again, it all depends on what you want to do with it. But a KL46Z is doable.
LikeLike
Thank you. I don’t need high performance. It will just be a control panel for a series of specialized medical devices. I guess I will see if it will work on the KL46Z and also learn more about the ColdFire in case I need to move up. Thank you for your advice.
LikeLike
The ColdFire is just an example. For sure using the KL46Z is more ‘future proof’ and will have enough processing power for the usual tasks.
LikeLike
Hi,
If I undestand correctly, the USBDM firmware can be loaded on to FRDM-KL25Z board and also on to the FRDM-KL05Z. ¿Do you know if the firmware can also be loaded on to the FRDM-KE02Z? ¿Do you know if there is some way to program (I’m not interested in debugging) a custom board with a KE02 device using the FRDM-KE02Z? The manual for the KE02z board (FRDM-KE02ZUM.pdf) says it can be done by removing a jumper but I havent read of anyone who has actually done so.
Thank you.
Juan.
LikeLike
I think this should be doable, but I have not tried it with my FRDM-KE02Z. And as I only have this board, I have not used it to program another KE02 board. But to program another board (without debugger) you do not need USBDM: the normal FRDM board can be used for this, see https://mcuoneclipse.com/2013/04/21/using-the-freedom-board-as-jtag-programmer/.
I hope this helps?
LikeLike
¡Thank you! It seems the freescale guys realized many people wanted to use the FRDM as a programmer and the KE02Z has a 0 ohm resistor in SWD_CLK. When I have my custom board I’ll let you know how it went.
Juan.
LikeLike
Hi Erich ! First I thank you for all your job ! I think if I didn’t find your website,my twr kit would be burned more than one time !
Currently, I have a problem with a project in CW and I did’nt find the solution after hours crying ! So I tried my chance here !
The project works fine with the ARM compiler but when I’m reussing the same one with the GCC C compiler I obtain errors ! :s
arm-none-eabi-gcc: error: ./Sources/PROJECT/../cpu/…/the_file.o: No such file or directory
The project contain .asm and I suppose that I need to change some settings but I’m a bit lost.
If you have an idea I will be glad !
Thanks a lot Erich for all your help !
LikeLike
Hi Jeremie,
good to hear that things are useful for you :-).
About your problem: what is the source file name for the_file.o? If it is *.asm, can you try to rename it to *.s (or *.S) to see if this makes a difference? I remember that I had probelms if extension was not *.s (or *.S).
I hope this helps?
LikeLike
The other thought I have: are there multiple source files with the same base name (e.g. the_file.asm and the_file.c)? If so: I know that CodeWarrior is able to handle that, but not the standard GCC/GNU toolchain. Maybe this is your problem? If so, then try to rename one or the other file to a ‘non-conflicting’ source file name.
LikeLike
I passed two day on it… checking every settings … and it was the extension name !!! It works with the .S !
Thanks a lot Erich !
LikeLike
Yeah, I think I had that problem too, and as far as I know even *.S was not the same as *.s (even on Windows). Glad to hear that we have sorted that out.
LikeLike
Hey Erich,
I’m trying to generate custom signals. Currently it’s a sum of 2 sinewaves, one of 80 Hz and the other of 125 Hz. To get a decent period I need 2000 samples but when I change the KL25Z array size (where I store the data points) to 2000 I no longer get any output from my DAC. If I change it back to something like 500 I get the output that I am expecting by obviously incomplete. Do you have any idea why? Thanks in advance.
More info: I use static LDD_DAC_TData array to store data points for the DAC.
-Nick.
LikeLike
The KL25Z has only 16kB of RAM. You may be running out RAM. Try putting your sine table in flash or using interpolation in a lower-resolution table.
LikeLike
Hey Erich,
I tried your suggestion and I got it working now, thanks again Erich,
Regards,
-Nick.
LikeLike
I have not checked the details, but it looks like there is a limitation with the number of bits for the size? If it would work with less than 256, that might indicate that only 8bits are supported. Does it work with 512? 1024?
LikeLike
Does any one have a modbus PE component for the KL25Z?
LikeLike
I had no need for ModBus (yet?), so I have not created one. Maybe somebody else did?
LikeLike
Hey Erich,
I am trying to get the KL25Z to send data wireless using the Arduino WiFi Shield. I have no idea how to start can you suggest something to get me started? Thank you in advance.
Best regards,
Nicola.
LikeLike
Hi Nicola,
I have the AdafruIT CC3000 shield, but no time to use it yet:
http://www.adafruit.com/products/1491
LikeLike
Hey Erich,
That’s absolutely fine, I’m sure you’re very busy. Is the process of communicating between the boards (i,e, between the kl25z and arduino motor) similar? If so would it be possible if I would consult your KL25Z and Arduino Motor board Tutorial and use that to set the Arduino WiFi. I’m aware that they are completely different board but I’m just interested in the implementation process. Thank you in advance.
Regards,
Nicola.
LikeLike
Hi Nick,
the implementation process is very similar: find out what are the pins and devices, which protocols to use, and then write or use a driver to access the devices.
Probably it will be more similar to this one: https://mcuoneclipse.com/2014/01/05/frdm-with-ardino-ethernet-shield-r3-part-1-sd-card/
LikeLike
hi..my project is to send the data using bluetooth module.is that possible if i want to connect hc-05 from PIC1 as a transmitter and hc-06 as a receiver at PIC2 ?
LikeLike
The HC-06 Bluetooth module only can be a slave, but the HC-05 is able to be a master too. So with the HC-05 as master, you should be able to connect from teh HC-06 module. What microcontroller (PIC, TI, Freescale, STM) does not matter 🙂
LikeLike
Tq vey much n do you know steps to link hc-05 with hc-06 ? or any type of resources that i can refer to.
LikeLike
Hello,
Have a look at https://mcuoneclipse.com/2013/02/14/bluetooth-with-the-freedom-board/ : you need to configure the HC-05 as master.
And then see https://mcuoneclipse.com/2013/06/19/using-the-hc-06-bluetooth-module/ : you have to configure the HC-06 (which is automatically slave).
I hope this helps,
Erich
LikeLike
Good day!
I’m currently using frdm-kl25z board. I was able to test the sample program for touchpad using TSS. In this example, the board will go to sleep mode after several second when no touch is detected.
You can wake-up the board by touching the right electrode. My question is that, is there a way to wakeup the board by touching either one of the 2 (left or right) electrodes?
Thanks in advance.
LikeLike
That will depend if you can generate an interrupt for either the left or the right electrode.
LikeLike
Yap that’s really my question. I just want to know If that is possible. If yes, how to implement that interrupt?
Thanks.
LikeLike
I’m travelling, so I do not have the data sheet/reference manual with me. I suggest you check in the manual if you can have an interrupt on these pins (either directly or throught the TSS module), and if they are available in your low power mode?
LikeLike
Hi,
I am having an issue with the second half of my RAM, in regards to how much space it is taking up in flash.
Basically as I understand it the sum of the “.text” and “.data” areas is how much flash is being used (.text + .data = total flash usage).
When I define a normal uninitialized array
static char myBuffer[16];
the .bss increases by 16 bytes and the .data area stays the same, which is what I would have expected.
The issue is when I define an array using the second half of my RAM, the .data size increases by 4096 bytes instead of the .bss area. This seems to indicate the compiler is initializing it to zero and storing 4096 zero bytes in flash (need to check the .map file)
static unsigned char myBuffer[4096] __attribute__((section (“.m_data_20000000”)));
BEFORE:
text data bss dec
0x2304 0x28 0x310 9788
AFTER:
text data bss dec
0x2304 0x1028 0x310 13884
Do I need to add a command line argument to stop this happening?
NOTE: I am using an MK10DX32 which has 8KB of RAM split into two 4KB sections.
LikeLike
Hi Andy,
indeed, I see your problem. Let me investigate….
Erich
LikeLike
Hi Andy,
see https://mcuoneclipse.com/2014/04/19/gnu-linker-can-you-not-initialize-my-variable/
Erich
LikeLike
Hello Erich!
With your help to the community, I am now a fan of Freescale microcontrollers!
Also, with your great help and I can learn and do stuff, and even the complex ones such as USB CDC with a KL25Z!
I have done this using Processor Expert as you have explained in one of your blog posts. However, I am a little worried since I don’t know much about it. What are the possible disadvantages of Processor Expert? Can I extract USB CDC code only and use it in a Bare Metal Project?
LikeLike
Hi,
glad to be able to help out these kind of topics. And good point about Processor Expert: I have started writing up a post about Processor Expert, Arduino and mbed in general, where I see they all fit. And you do not need to be worried about Processor Expert: it is all normal C code it produces, so it is up to you and take that source code and do whatever you want to do with it. So yes, you can extract the USB CDC code and use it in another project (not Processor Expert based) or bare metal project. I think I need to spend more time on that (unfinished) article, hopefully in the next days. Will see, but there is so much I need to catch up after FTF….
LikeLike
Hey Erich,
I apologise in advance if someone have already asked this question.
I would like to know how you can set the ADC to sample at a specific frequency (i.e. 10 kHz)? Do you use a wait() or a timer of some sort?
Thank you in advance!
LikeLike
Hi Nic,
Typically, a periodic timer interrupt could be used. But 10 kHz is a rather high frequency, so it would be better to use DMA for this.
See freescale community docs/DOC-96507
LikeLike
Hey Erich,
Thank you for the reply. I tried implementing the sampling rate with the periodic timer as it seemed like a better idea to start off. I’ve chosen one of the available interrupt rate of 4 kHz.
I’m trying to make a simple 2 pole IIR filter with the kl25z but this is what I get at the output; I can’t quite figure out what to make of it. Maybe if you don’t mind you can comment on it: http://imgur.com/XWQ7c3l
this is my current code for ProcessorExpert.c:
static uint16_t DACvalue, ADCvalue;
volatile bool sample_interrupt;
static LDD_TError Error;
static LDD_TDeviceData *MyDacPtr;
double x[3], y[3];
/*lint -save -e970 Disable MISRA rule (6.3) checking. */
int main(void)
/*lint -restore Enable MISRA rule (6.3) checking. */
{
/* Write your local variable definition here */
/*** Processor Expert internal initialization. DON’T REMOVE THIS CODE!!! ***/
int i;
PE_low_level_init();
MyDacPtr = DAC_1_Init(NULL);
for(i=0; i<3; i++)x[i] = 0.0; // Init the registers
for(i=0; i0; i–) x[i] = x[i-1]; // Shift the delay register values.
(void)ADC_1_Measure(TRUE); /* do conversion and wait for the result */
(void)ADC_1_GetValue16(&ADCvalue); /* get the result into value variable */
x[0]=ADCvalue;
y[0]=(((-1.8741)*y[1])-(0.937*y[2])+x[0]-(1.8701*x[1])+(0.8781*x[2]))*0.937;
for (i=2; i>0; i–) y[i]=y[i-1]; // Shift the delay register values.
DACvalue=y[0];
while (!sample_interrupt){}
sample_interrupt=FALSE;
Error = DAC_1_SetValue(MyDacPtr, DACvalue); /* Set DA converter output */
}
This is for Event.c:
void TI1_OnInterrupt(LDD_TUserData *UserDataPtr)
{
extern volatile bool sample_interrupt;
sample_interrupt=TRUE;
}
Thank you in advance.
LikeLike
Pingback: GNU Linker, can you NOT Initialize my Variable? | MCU on Eclipse
Hi Erich,
I am using K60 micro controller. I have a doubt and I hope you will have an answer for it.
Is there any possibility to know the size of the image loaded to K60 Flash after it is loaded?
Thank you.
Regards,
Jagadeesh.
LikeLike
I think this is a universal question, not related at all to the K60? And I think you are interested in the code size?
If you have the .elf file, than you know it for sure: just decode it or generate an S19 out of it, and you know it. If you do not have this, and only have access to the flash memory, then you need to analyze the memory. Not sure why you want to do this? Maybe reverse engineering? 😉 In any case: check the data sheet of your device for the flash memory block size (1K byte? 4 KByte? etc). Then go through the flash memory map and check which blocks are erased (all bytes 0xFF), and which ones are not. Count the number of block (of each), and you should have a pretty good idea how large the image is.
LikeLike
Erich,
The Kinetis processors have a nice flash architecture that safely allows for field flash updates. Are there any processor expert components that help with erasing and updating one flash block while executing out of the other block, and then performing the swap?
Thanks,
Greg
LikeLike
Hi Greg,
I have not used that ‘swap’ feature. But I used a Processor Expert component to re-program my flash, see https://mcuoneclipse.com/2013/04/28/serial-bootloader-for-the-freedom-board-with-processor-expert/
Erich
LikeLike
Hi Erich,
I am trying to get usb cdc host to work with a Telit HR910 modem which is a cdc device and supports 6 endpoints. I am using the cdc_serial example for the TWR K40 board, But the twr board does not detect this usb device. I have checked all the jumper settings. The K40 board works well as a cdc device connected to my computer.
Thank you.
LikeLike
Hello,
I only can speculate that your modem seems to do something which is not handled in your K40 CDC host implementation. I guess you would need to deep dive with a USB protocol analyzer to see what is going wrong?
LikeLike
Hi Erich and others,
I need to enable the driver for an RS485 connection before I transmit a char to the serial port.
I can add a line to the SendChar function, created by PE, but of course the tool will remove it the next time it creates that function. Which otherwise works well.
What would be nice is an Event called before a start of transmitting, but I don’t see an Event to do that.
What is the best way to handle this ?
PS I’m using the OnTxComplete event to disable the driver.
LikeLike
Which component are you using? See
how you can prevent that your code gets removed.
LikeLike
are, that’s what I was looking for. Thanks again Erich.
LikeLike
BTW is was the “AsynchroSerial” component.
LikeLike
Hi Erich, i see you updated Processor components library recently, i used older one that i downloaded March 22, i worked with fatFs library. But now it doesn’t work anymore, i don’t know i redownloaded codewarrior, maybe its fault if it was upgraded. Problem: SD card SM1_SPIMaster can’t set two clock rates. Even your example for kl25z board with fatfs don’t work. What i mean don’t work is that when i use f_write to SD card it uses init clock speed 375kHz, and component inspector of SM1_SPImaster don’t accept mode1 frequency any more. SM1_SPIMaster is CW component so i think it’s CW fault.
LikeLike
Hi Tomas,
I only used a few projects with 10.6 (and run into another problem which I have solved on my end). It is getting late here, but I’ll have a look tomorrow. I saw you posted something in the FSL forum too. I keep you updated.
LikeLike
Hi Tomas,
I think I see your problem 😦 I had use that project in 10.6, and it worked fine. But you are right: the SynchroSerial component is broken: I had in 10.5 configured it for 375 kHz and 12 MHz. But when I check the values in 10.6, then it shows the values of 375 kHz (ok!) and 375 Mhz (yikes!). As long as I do not change or add values, it seems to be ok. But as soon as I change the values, it will be always 375 MHz, and that’s flagged correctly as an error. So I cannot enter a value 😦
Is this what you see?
Erich
LikeLike
Yes exactly! And its not displaying error, i checked SPI clock on SD card with oscilloscope and whatever numbers i write to Mode1 it uses Mode0 frequency anyway.
LikeLike
Thank you for the great posts regarding MCU. These are very helpful for beginner.
I have FRDM-KL25Z board and would like to add Bluetooth interface to this board. I want to connect Bluetooth board/module/hardware/adapter to KL25Z, what all options I have ? (I am not very much familiar with Hardware, pinouts etc)
Thanks
LikeLike
Hi Sandy,
Have a look here:
• https://mcuoneclipse.com/2013/02/14/bluetooth-with-the-freedom-board/
• https://mcuoneclipse.com/2013/06/19/using-the-hc-06-bluetooth-module/
Erich
LikeLike
Hi Erich. I would like to know how I do to save measures from Freedom board in a txt File…I am trying to use ‘fopen’ and ‘fprinf’ but it doesn’t work.
LikeLike
Hi Vinicius,
do you have a file system with an SD card or similar? fopen() or fprintf() only operate on files.
LikeLike
Erich, No I don’t have.
I’m using this way:
FILE *arqf;
arqf= fopen(“SolarCell.TXT”, “w”);
.
.
.
.
fprintf(arqf, “%.2f\t %.2f\t”, vPlaca, corrente);
fclose(arqf);
.
.
.
Can you explain with more details .
tks
Vinícius
LikeLike
Hi Vinicius,
ok, then it is clear to me that it does not work :-). To use the file functions (fopen(), fprintf(), …) you need to have files and a file system. So you need to use something link FatFS. See https://mcuoneclipse.com/2012/11/18/arduino-data-logger-shield-with-the-frdm-kl25z-board/
LikeLike
I am having an issue with your FRDM-K64F_SDK_FreeRTOS project. I have imported it into KDS and I have declared the path variable for the KSDK, but I have the following errors, etc:
Description Resource Path Location Type
implicit declaration of function ‘msg_queue_get’ [-Wimplicit-function-declaration] Application.c /FRDM-K64F_SDK_FreeRTOS/sources line 131 C/C++ Problem
‘kSuccess’ undeclared (first use in this function) Application.c /FRDM-K64F_SDK_FreeRTOS/sources line 128 C/C++ Problem
‘kSuccess’ undeclared (first use in this function) Application.c /FRDM-K64F_SDK_FreeRTOS/sources line 140 C/C++ Problem
implicit declaration of function ‘sync_create’ [-Wimplicit-function-declaration] Application.c /FRDM-K64F_SDK_FreeRTOS/sources line 140 C/C++ Problem
implicit declaration of function ‘msg_queue_create’ [-Wimplicit-function-declaration] Application.c /FRDM-K64F_SDK_FreeRTOS/sources line 127 C/C++ Problem
implicit declaration of function ‘event_wait’ [-Wimplicit-function-declaration] Application.c /FRDM-K64F_SDK_FreeRTOS/sources line 114 C/C++ Problem
implicit declaration of function ‘msg_queue_put’ [-Wimplicit-function-declaration] Application.c /FRDM-K64F_SDK_FreeRTOS/sources line 128 C/C++ Problem
assignment makes pointer from integer without a cast [enabled by default] Application.c /FRDM-K64F_SDK_FreeRTOS/sources line 127 C/C++ Problem
implicit declaration of function ‘__task_create’ [-Wimplicit-function-declaration] Application.c /FRDM-K64F_SDK_FreeRTOS/sources line 147 C/C++ Problem
implicit declaration of function ‘sync_wait’ [-Wimplicit-function-declaration] Application.c /FRDM-K64F_SDK_FreeRTOS/sources line 65 C/C++ Problem
unknown type name ‘event_clear_type’ FRDM-K64F_SDK_FreeRTOS line 112, external location: C:\Freescale\KSDK_1.0.0-Beta\rtos\fsl_os_abstraction_free_rtos.h C/C++ Problem
‘kSuccess’ undeclared (first use in this function) Application.c /FRDM-K64F_SDK_FreeRTOS/sources line 65 C/C++ Problem
implicit declaration of function ‘sync_signal’ [-Wimplicit-function-declaration] Application.c /FRDM-K64F_SDK_FreeRTOS/sources line 56 C/C++ Problem
implicit declaration of function ‘task_destroy’ [-Wimplicit-function-declaration] Application.c /FRDM-K64F_SDK_FreeRTOS/sources line 78 C/C++ Problem
‘kSuccess’ undeclared (first use in this function) Application.c /FRDM-K64F_SDK_FreeRTOS/sources line 78 C/C++ Problem
each undeclared identifier is reported only once for each function it appears in Application.c /FRDM-K64F_SDK_FreeRTOS/sources line 65 C/C++ Problem
implicit declaration of function ‘sync_poll’ [-Wimplicit-function-declaration] Application.c /FRDM-K64F_SDK_FreeRTOS/sources line 70 C/C++ Problem
‘kSuccess’ undeclared (first use in this function) Application.c /FRDM-K64F_SDK_FreeRTOS/sources line 95 C/C++ Problem
implicit declaration of function ‘event_set’ [-Wimplicit-function-declaration] Application.c /FRDM-K64F_SDK_FreeRTOS/sources line 98 C/C++ Problem
implicit declaration of function ‘event_create’ [-Wimplicit-function-declaration] Application.c /FRDM-K64F_SDK_FreeRTOS/sources line 95 C/C++ Problem
‘kEventAutoClr’ undeclared (first use in this function) Application.c /FRDM-K64F_SDK_FreeRTOS/sources line 95 C/C++ Problem
make: *** [sources/Application.o] Error 1 FRDM-K64F_SDK_FreeRTOS C/C++ Problem
‘kFlagSet’ undeclared (first use in this function) Application.c /FRDM-K64F_SDK_FreeRTOS/sources line 107 C/C++ Problem
‘kFlagNotSet’ undeclared (first use in this function) Application.c /FRDM-K64F_SDK_FreeRTOS/sources line 110 C/C++ Problem
implicit declaration of function ‘event_clear’ [-Wimplicit-function-declaration] Application.c /FRDM-K64F_SDK_FreeRTOS/sources line 101 C/C++ Problem
implicit declaration of function ‘event_check_flags’ [-Wimplicit-function-declaration] Application.c /FRDM-K64F_SDK_FreeRTOS/sources line 107 C/C++ Problem
Any help on this is greatly appreciated.
LikeLike
Hi Rob,
I do not see the same problems, but I had to fix several things with the latest KDS V1.0.1 beta. I have now commited the changes, see
https://github.com/ErichStyger/mcuoneclipse/commit/099923ddb6423fc2b1c878b7528302936092e501
Can you verify if you still have problems?
LikeLike
Thanks for the update. It does build and now I just have to figure out how to load it through mbed. So far, it fails on the elf file with bad extension. I will have to dig through documentation as this is a new project for me with the FRDM-K64F.
LikeLike
You need a .bin file for the mbed MSD loader, see https://mcuoneclipse.com/2014/04/20/binary-files-for-the-mbed-bootloader-with-eclipse-and-gnu-arm-eclipse-plugins/.
But in any case: I recommend that you use the debugger and not the MSD bootloader while doing development.
LikeLike
Resolved my binary issue by making the bin file, but now debugging a problem involving the fail.txt file on mbed giving a “RESERVED BITS” error. Definitely getting close to loading the board.
LikeLike
Make sure you load the latet mbed firmware on the board (the board shipped has an old firmware on it with many bugs). The latest one today is 0202 (https://mbed.org/handbook/Firmware-FRDM-K64F). Or better, use a debug firmware like the P&E or Segger (https://mcuoneclipse.com/2014/04/27/segger-j-link-firmware-for-opensdav2/)
LikeLike
mbed was the whole problem. I connected power through the usb port that isn’t labeled OpenSDA and used a P & E micro to program without any hiccups.
LikeLike
Yes, I had many problems with the mbed firmware. There is a new 0202 firmware available on the mbed side which is better. I switched over to P&E and Segger firmware (see https://mcuoneclipse.com/2014/04/27/segger-j-link-firmware-for-opensdav2/). As for recovering your mbed: see https://mcuoneclipse.com/2014/04/19/recovering-frdm-k64f-mbed-board/
LikeLike
Hello, I have just read you article about the hc 06 bluetooth module. I have bought one of that and I have a very strange bug.
So I would like to communicate between an atmega8 and my PC via this module. So I set up, wrote the basic code ( without interrupts ) but the communication doesn’t work properly.I want to send a character from the PC and then get back the same character from the atmega.
So if I send a char then I get back wrong data..BUT If I send constant characters from the microcontroller then I get those nicely on PC, this means the controller doesn’t get the correct characer. I tried with an external crystal (8MHZ) too but nothing changes. (I use the default settings: 9600 baudrate, no parity, 1 stop bit)
I also tested the module with an arduino, and there worked fine..(I got back what I have sent)
Could you help me? Maybe I have the same or similar issue like yours?
LikeLike
Hello,
that might depend how each microcontroller is using the serial lines with pull resistors or not. I had such a problem described in this article:
So you could try if adding an external or internal pull resistor helps?
LikeLike
I have problem when I send data from PC to the controller, I don’t get back the right characters. But when I send directly from the controller then I get them. You had the problem with the module TX pin no? You couldn’t send anything from the BT module, right? I checked my BT module, and I have that diode there too.
LikeLike
Best if you connect a logic analyzer to the tx and rx pins of the module to check what is going on?
LikeLike
Hi Erich,
Is there a way to save my data in KL15Z32VLH4 even in power lost? It dont have an EEprom?
Thank you for your usual support.
Javer
LikeLike
Hi Javer,
it all depends how much data you need to save, but in any case you can use an external EEPROM too, or use the internal flash. But you need to make sure that a) you correctly detect the power loss and b) you have enough time and energy to save the values.
LikeLike
Hi Erich,
Do you have any example on how to implement it in internal flash? Adding an external eeprom now is not an option due to some design requirements.
Thanks for the quick response.
LikeLike
Hi Javer,
see https://mcuoneclipse.com/2014/05/31/configuration-data-using-the-internal-flash-instead-of-an-external-eeprom/
LikeLike
Hi Erich,
Is there a settings in CW that can optimize my code? so i can minimize the size of my compiled binary? Something like disregarding any unnecessary file/code
Thanks…
LikeLike
Hi Javer,
yes, by the default project settings (as created by the new project wizard), any unreferenced functions and variables will not be linked. Make sure you have -ffunction-sections and -fdata_sections options set in your project (they are enabled by default).
LikeLike
Hi Erich,
I’m an electronic engeneer student in Trieste Italy, and i’m approcing to embedded system trough the KL25Z freedom board that ,by the way, is awsome.
I’ve done a project with accelerometer, distance meter hc-sr04, temperature sensor with ntc 150k termistor and an lcd 20×4 with a menu controlled by slider for going up/down and a phisical button to enter/exit from/to functions.
My problem is that i’m not an expert of c coding and i would like to have a better response and sensitivity from the slider. can you give me a hint?
the link with the project files is
https://dl.dropboxusercontent.com/u/30331977/ProgettoManhattan2.0.rar
don’t be afraid from the name of the project, it’s just a joke because for me this project is a bombshell 🙂
If you don’t understand something contact me whenever you want.
And by the way sorry for my english!
Adriano
LikeLike
Hi Adriano,
unfortunately I cannot help you much on this. To dig through your code would require substantiel amount of time (I do not have currently). Guess you should be as student of my class, because then you will get this as part of the course 😉
LikeLike
Thank you anyway. I will try a couple of solution that i have in mind. Just a thing: i can’t understand how it’s working the flags for the touch, i know that there is one flag named YourFunctionName.DynamicMovement.Direction (or something like this) but i can’t understand how it is working because from the debugger i can’t see it change but it should change if you slide from left to right or from right to left.
I promise that this is my last question then i will keep studying on my own. 😀
thanks again
Adriano
LikeLike
Hi Adriano, I stopped using the touch drivers because there are no sources, and I was not able to get it working correctly. It works sometimes, but not always. I stopped wasting my time with it.
LikeLike
HI, first of all. nice work ! This saved me a couple of hour trying to start my design ! One quicl question, if I want to add my own command to the shell component. How should I do that ?
regards.
LikeLike
Thanks 🙂
Exending shell commands is very easy, and there are many examples on GitHub.
See for example NMEA_ParseCommand().
a) write a parser/handler (see https://github.com/ErichStyger/mcuoneclipse/blob/master/Examples/Eclipse/FRDM-KL25Z/FRDM-KL25Z_Adafruit_GPS/Sources/NMEA.c)
b) call it from your shell module (see https://github.com/ErichStyger/mcuoneclipse/blob/master/Examples/Eclipse/FRDM-KL25Z/FRDM-KL25Z_Adafruit_GPS/Sources/Shell.c)
I hope this helps?
Erich
LikeLike
Hi Erich,
Does the timeout component in PEx requires the RTOS to be enable?
I do it like this.
TMOUT1_Init();
handle = TMOUT1_GetCounter(4000);
res = TMOUT1_Value(handle);
while (TMOUT1_CounterExpired(handle) != TRUE) {
printf(“%d rn”, res);
}
TMOUT1_LeaveCounter(handle);
printf(“%d rn”, res);
Unfortunately it doesn’t work. 😦
Thanks in advance.
LikeLike
Hi Javer,
Did you know that there is a help for each component?
I admit that the help for my components is not the most complete one, but the Timeout component has a ‘typcical usage’ example.
For your code you have provided:
No need to call TMOUT1_Init() as this is done automatically.
Typical example:
{
TMOUT1_CounterHandle timeout;
timeout = TMOUT1_GetCounter(500/TMOUT1_TICK_PERIOD_MS); /* 500 ms timeout */
for (;;) { /* will timeout */
/* do something here */
if (TMOUT1_CounterExpired(timeout)) { /* check for timeout */
break; /* break for loop in case of timeout */
}
} /* for */
TMOUT1_LeaveCounter(timeout); /* release timeout counter */
}
What you probably missed is to call TMOUT1_AddTick()? You need to call this with the frequency specified in the properties (e.g. every 10 ms). This can be done from a timer interrupt. Or from the RTOS tick counter. But you do not need an RTOS for this.
For more examples, google for
mcuoneclipse github TMOUT1_AddTick()
I hope this helps?
LikeLike
You’re correct, I missed to call TMOUT1_AddTick()…
Now its working 🙂 .. Thank you Erich..
LikeLike
I just start working on embedded system programming.
I saw many IDEs on Windows. But I want to work on Mac, And I think Eclipse is the best choice here.
But I have no experiment to setup tool and config to make it work. Everything just looks to complex for me
I have an IAR kickstart kit for Cortex M0.
Where should I start, I try to search through but not much how to for Mac.
LikeLike
Yes, you are right: you will find most for Windows, then for Linux. Mac has not been used in the past much for development somehow, but I see that usage of Mac is growing. The good news is that Eclipse runs on Mac. Personally I do not have a Mac machine, but my tutorial (https://mcuoneclipse.com/2013/07/20/dyi-free-toolchain-for-kinetis-part-1-gnu-arm-build-tools/) is applicable for Mac too, with the exception that Processor Expert does not exist on Mac yet. But Kinetis Design Studio (https://mcuoneclipse.com/2014/04/09/ftf-frdm-k64f-kinetis-design-studio-and-kinetis-sdk/) is supposed to support Mac too in the October timeframe this year.
LikeLike
Thank you
I will try it tonight
LikeLike
PROBLEM WITH FREESCALE CDC DEVICE ON FRDM-K64F…
Hello Erich,
after implemented the Segger OpenSDAv2 on my FRDM-K64f board, and after builded a little project with FSL_USB_Stack component as CDC device on CW MCU 10.6 (re-writing an old proj running perfectly on KL25Z MCU, i have ecountered problems to install a right device driver on my windows vista 32b machine for new usb interface presented by K64 mcu.
The procedure show on Documentation folder (cdc.inf, cdc.inf_readme.txt) not run on my Vista 32b machine… may be? (“device not recognized” after driver installation)
The version of Freescale USB Stack is 4.1.1 (as CDC device).
Can you help me, please? tnx.
LikeLike
Hi Antonio,
the port for the K64F is simply not working yet. I started working on it a few weeks back, but it is not operational yet. Simply not having enough time to debug it 😦
Erich
LikeLike
Hi Erich,
Do you have any example of using TSI without using TSS library. TSS library is very huge make my code bigger and bigger . Besides sometimes it didn’t function well. 😦
Thanks for your usual support.
LikeLike
Hi Javer,
I stopped using the TSI library, because it is closed source and not easy to use. And as you say it is huge and complicated. I used an external capacitive touch IC/controller for two of my projects instead.
I do have a simple example doing simple touch (touch button) detection, but without any special filtering/etc. But that has been a while back.
Erich
LikeLike
I think I go with your idea to use an external capacitive touch IC/controller. Thanks you so much Erich.
LikeLike
I have been hired by a to-be rapid prototyping centre’s management and am required straight away to suggest some development/evaluation kits that would be helpful in developing prototypes. The problem is that I don’t know the specific requirements of the prototypes order we’ll get and thus I need to select handful of general purpose kits. Do you have any suggestions as the variety of products (hundreds of them from each supplier) confuses me. e.g. Tower system and freedom development platforms have a lot of products from freescale and similarly products from TI, Atmel, STMicroelectronics etc.
LikeLike
I have spent a great deal of time the last several months sorting through hundreds of MCU kits and can offer a tiny bit of guidance.
1. You can’t know everything about all the MCU architectures out there so narrow it down to one or two to learn about. Because 32 bit ARM is hot and growing and cheap, I have just stuck with that.
2. You can’t know everything about all the ARM silicon vendors. It seems to me that Freescale, NXP, and STM have the broadest variety of ARM MCUs.
3. Some of the MCU eval board vendors that seem to have a good selection are:
http://microcontrollershop.com
http://www.embest-tech.com
http://www.wvshare.com
The Freescale Freedom boards are an excellent starter platform.
The STM32F429i Discovery with TFT touch screen is a great value at $24 from Mouser.com. The STM32F line has lots of good cheap options. Their Nucleo STM32F boards are only $10.
I also like the LPC4300 series from NXP because they have two (or 3!) MCU cores on the same silicon which is great for anything that requires a lot of I/O or graphics. (Some of the LPC4300s actually have an onboard graphics controller.) And there are some very good and inexpensive starter kits available with them.
You can get the NXP LPC4370 (THREE CORE!) chip on a neat little board for $20 from Mouser. This board can be used as a JTAG programmer or a development board. You’ll want two of these boards to if you want to do development with it.
With three core technology so cheap and powerful, I expect the market for it will increase greatly within the next 12 to 18 months. In my case, I feel I might as well learn about it now so I can keep up with the curve.
I also expect there will be a lot of new development boards to come out over the next 12 months or so, so there will always be a need to keep informed. But if you have a couple of favorite vendors and chips, you should be able to find the boards you need to do your new job.
Congrats on that, by the way.
If you come up with any better alternatives than I mentioned above, I would be grateful if you posted them.
Thank you.
LikeLike
One more thing, make sure you know which IDE you are planning to use before you make a suggestion or purchase. If you are planning on mainly using free IDEs, make sure the one you choose works with the board you are suggesting, and that there are no code size limitations.
And, if you want to do anything other than plain C coding (such as using a graphics library, bus driver software, or anything else) make sure it all integrates with your IDE. I have spent a great deal of time the last few months trying to sort all that out as well. It can waste a LOT of time if you don’t know what you are doing. (I speak from experience. 😉 )
LikeLike
I had a very simple project last week needing a micro.
I pulled out an old friend, MC9S08SH8. 20-pin DIP, and programmed with USBDM under CodeWarrior 10.6.
It was like a breath of fresh air after working with these newer, infinitely more complex chips.
-Bill
LikeLike
Yes, I had the same feeling a month ago when I used an S08 for a design: these microcontrollers are by factors simpler (and easier in many aspects).
LikeLike
Hi Erich or other :p
I have a problem with my FRDM – K64F. I wrote a code in eclipse in c++ and everything works well. However, when I’m trying to have the hardware fpu instead of the software, my cpu hangs. I’ve put the code on github if you want to see.
https://github.com/ediukill/Hexacopter.git
Sincerely,
LikeLike
Hi Gabriel,
I would say it is because you have Float ABI set to ‘Library with FP (softfp)’ and not for ‘FP instructions (hard)’.
Erich
LikeLike
Hi Erich,
I have a timer with period of 30us and i want to communicate with uart.
But, when I a wait, for example WAIT1_Waitms(500); it stucks there. So I have to disable that timer and perform the wait and after it enable timer. But this isn’t the solution that I want because I need timer too.
So I think that the solution is to implement dma on uart.
So, can you guide me how to implement uart with dma on kl25?
Thanks a lot for your work 🙂
LikeLike
When you do the WAIT1_Waitms(500), it will loop there for 500 ms. Your interrupts are still there and working. But this waiting for 500 ms will be a waiting time without the time spent in the interrupts.
So if you do heavy work in your interrupt (and 30 us are quite a lot of interrupts), then it will wait for 500ms *plus* the time you spend in the interrupt(s). Maybe this is your problem?
If you need to wait for 500 ms without the impact from the interrupts, then you need to do a different approach: either use an RTOS like FreeRTOS which will do preemption, or use the TimeOut Processor Expert component I have created.
LikeLike
Can you help me to implement TimeOut ?
And, what about uart DMA ?
LikeLike
Using the TimeOut component is pretty straigt forward:
a) add it to your project
b) Call the AddTick() method from your application.
For b), use a frequency as specified in the Timeout component properties (Counter tick period (ms)), default is 10 ms (100 Hz).
I hope this helps.
And I’m not using UART with DMA, so I had no need for this.
LikeLike
Hi Erich,
I am trying to learn how to program freescale microcontrollers using their Processor Expert with little success.
I have been able to select my board’s MCU, configure all its components and generate Processor Expert code in C.
The problem comes when I try to build the binary file for the C program.
What I want is one simple *.bin file that I can drag and drop onto the board when I connect it to my PC via USB (I’m using 64-bit Windows 7).
I think that I have set up Processor Expert wrong or I do not have the correct ARM compiler/linker/assembler on my machine (or perhaps eclipse is just unable to find them)
What step-by-step process do you recommend for installing Processor Expert, downloading and configuring the compiler/linker/assembler to work with eclipse, building a binary and loading it onto a board?
I’m using 64-bit windows 7 and Freescale’s MK60 family of processor (on a custom board).
(If you’ve already written about this please redirect me)
Thanks,
Ryan
LikeLike
Hi Ryan,
So you have a custom MK60 board, and want to drag&drop the binary to the target board? So do you have a bootloader implemented on that board/processor for this? Such drag&drop programming is supported if you have a MSD (Mass Storage Bootloader) bootloader implemented, e.g. what comes with the OpenSDA (see https://mcuoneclipse.com/2012/09/20/opensda-on-the-freedom-kl25z-board/).
To create .bin files (e.g. for mbed) see https://mcuoneclipse.com/2014/04/20/binary-files-for-the-mbed-bootloader-with-eclipse-and-gnu-arm-eclipse-plugins/
For s19 files, see https://mcuoneclipse.com/2012/09/13/s-record-generation-with-gcc-for-armkinetis/
There are several step-by-step tutorial on this blog (e.g. ), but they all depend on some degree on the board and hardware connection you are using. So I’m affraid that I do not have the bandwidth to write tutorials for every combination (there would be thousands!). You could simply google for ‘mcuoneclipse tutorial’ to get all the different tutorials?
After reading again your question, it sounds to me that you think that ‘drag&drop’ is the normal way to program a board? That’s not the normal way (it is the only way mbed can do it, but it is *not* the usual way): the usual way is to use a JTAG/SWD debug connection.
I hope this helps?
LikeLike
Hi Erich
I am working on KL26Z USB composite device with keyboard and media keyboard.
But, PE component only can generate individual HID device.
How can I create a composite device through PE?
thanks.
LikeLike
Hi Kyle,
I have not done that. I know that there is a combined example in the USB 4.1.1 stack, but I have not used it. I started to build a combined USB HID+KBD device, but have not finished it because of other work items.
LikeLike
Hi Erich
Thanks for your reply.
Yes, I know there is a combined example in the USB4.1.1 stack.
But it is not built by processor expert, I hope I can based on PE USB stack to add composite function.
Because processor expert is very help when develop applications.
Looking forward your good news.
LikeLike
Hi Kyle,
Yes, it would be possible to create a Processor Expert component for that. Actually everyone could do that. And it could be even a ‘USB device construction kit’ where you can say “I want USB CDC combined with MSD, and hey, add HID mouse to the mix”. Very well doable. But someone needs to spend the engineering hours actually doing it. Would be a pretty nice week-end project. Unfortunately I only have a number of week-ends every year, and they are already filled up with work. Any volunteers out there?
LikeLike
Hi Erich,
I have a question about FreeRTOS 8.0.1 in the latest PE from July 13. I’m using CW 10.6 and a K20DN64. When I include FreeRTOS it is getting an error on the FRTOS1.c &.h files in the huge comment header at the beginning. What it is doing is putting a secondary comment on two lines like this:
configCPU_CLOCK_HZ : CPU_CORE_CLK_HZ /* CPU core clock from Processor Expert Cpu.h */
&
configBUS_CLOCK_HZ : CPU_BUS_CLK_HZ /* CPU bus clock from Processor Expert Cpu.h */
of course the trailing “*/” is causing the remainder of the comment header to be treated as source and generates lots of errors.
I’m also getting an error in Port.c at this line:
SET_TICK_DURATION(TIMER_COUNTS_FOR_ONE_TICK-1UL);
The reason is CPU_CORE_CLK_HZ is not defined. I can fix this error by adding
#include “cpu.h” to the file.
I have modified the files to get a clean compile but each time I add or change a PE component it overwrites them again. I guess I could exclude them from the build?
Am I doing something wrong here? If needed I can send you these files, screen shots or the whole project.
Thanks
LikeLike
Hmm, I do not have this on my side (maybe fixed on my side). Can you send me details (screenshots) to erich dot styger at hslu dot ch ?
In any case: the driver/sources used are in
C:\ProgramData\Processor Expert\CWMCU_PE5_00\Drivers\freeRTOS
so if necessary, you can patch them directly. But of course I want to avoid that others run into the same problem, so I would like to fix your problem.
LikeLike
Ok, I have found an issue that comments were used in the default settings, if ‘static code’ in the FreeRTOS component is enabled. I guess this was enabled by mistake?
I have removed the comments and committed the change: https://github.com/ErichStyger/mcuoneclipse/commit/648a6e9407eebe5550134a286b16c9fd43e83786
LikeLike
Hi Erich.
Can you helping understand how Zigbee works?.
I’m currently working on a project, and well, It didn’t go as I’ve through.
I don’t understand how to use ZCL and how It managed to use multiple endpoints.
Do you have some note or documents I can use for it?
Thanks for Advanced.
LikeLike
I did a quick search for “zigbee zcl tutorial” on ixquick.com and found this as the first result:
http://www.freaklabs.org/index.php/Blog/Zigbee/A-Brief-Tutorial-on-the-ZCL-with-Examples-from-FreakZ.html
That seems like a good place to start.
LikeLike
Dear all,
I am using Eclipse Luna with GNU ARM Embedded Toolchain to build Kinetis MK21F12 projects. Since I want to know exactly what happens when compiling my code, I use a self generated makefile and linker script for building my sources.
So far everything worked as expected. But now I am trying to get newlibs printf() working to use it as a debug console. As long as I type printf(“This is an example.\n”) everything works fine. Typing printf(“This is an example.”) causes and hard fault exception. When using int tmp = 1 and printf(“This is a number: %d”, tmp) to write an integer I get the same hard fault exception. I adapted syscalls.c to fit for my application. Communication uses a standard serial interface.
As long as I use the bare UART interface, everything works as expected.
Is there anybody who had similar problems using newlibs printf()?
Best regards,
Philipp
LikeLike
I solved the problem by using newlib-nano instead of newlib by adding the linker flag -specs=nano.specs.
It seems to me that I had some major memory problems regarding heap and stack sizes. I’m going to figure out the exact reason why I have received these errors.
Best regards,
Philipp
LikeLike
Hi Philipp,
using the nanoLib for sure uses different internal library configuration. It very likely could be a heap or stack issue.
LikeLike
Hi Erich,
Good day.
Can you share some example code on how to enter LLS mode using processor expert “(i dont have an external reference clock)”. Im having a hard time setting all parameters in CW. 😦 .. Also my problem is to wake-up from this LLS using TSI interrupt.
Thanks you very much.. Hope you can help me…
LikeLike
Have a look here: https://mcuoneclipse.com/2014/03/16/starting-point-for-kinetis-low-power-lls-mode/
LikeLike
Just saw you example 🙂 ,its a very good start for my application.. How about setting tsi as source of my wakeup.. Do not know how to configure it in PEx. 😦
Thanks in advance..
LikeLike
It should not really matter which interrupt you select as wake-up source.
I have used the TSI in the past (see https://mcuoneclipse.com/2012/09/30/tutorial-touching-the-freedom-kl25z-board/) but I do not use it any more, as it was not working well for me. Good luck!
LikeLike
Hi Erich,
I just come to embedded system for about 4 months. I don’t have much basic knowledge.
Although at this time I can come up with how to use tool, and develop some basic application ( almost base on my software experience and code example I can find online )
At this time I feel that I need more basic knowledge. But I don’t know where should I start.
Can you give me some suggestion about book or course for embedded system.
I currently work on STM32F0
I have a STM32F0 evaluation board, Nordic bluetooth evaluation board, arduino, raspberry and some custom build board of STM32F0 that I got from my friend old project.
Thank you so much
LikeLike
Hi Tran,
it is hard to give a general advice. I have a look at the articles at adafruit.com, pololu.com and sparkfun.com (for their hardware/boards). They provide very good tutorials and background information. If you are interested in Embedded Systems programming in general, I can recommend https://mcuoneclipse.com/2013/05/15/software-engineering-for-embedded-systems/ 🙂
LikeLike
Hi Erich,
I currently got in problem when using ADC to record audio and then play back use DAC. It’s kind of have electronic noise in background. I don’t know if my code did something wrong. or it’s problem of hardware.
Do you have any suggestion for my situation.
It’s a custom board.
LikeLike
I think you need to check your analog signal, if you are already sampling the noise. I think your input signal is probably not clean.
LikeLike
leobin1989,
You may also want to check all your ground paths. There might be a loose connection.
Do you have any ripple on your DC lines?
You may want to try putting a variety of filter caps across all of your chips and power supply inputs.
LikeLike
Hello Tran,
For just starting out, I think getting a couple of Freedom boards from Freescale and then following Erich’s tutorials is a great place to start.
I have been trying to learn the STM32 line for the last few months and have found that all of their example programs require paying several thousands of dollars for an IDE. They don’t have anything for eclipse.
After you get familiar with the Freedom boards, you may want to learn about the NXP line if you need more MCU power. They have a free IDE and some MCU chips with two or three MCUs inside the same chip, specifically the LXP4300 series.
But, if you don’t need high speed I/O, video processing and computation all at the same time, the Freedom boards will go a long way for you, and Erich’s blog here is the best I have found in the last three and a half years of web surfing the MCU educational marketplace.
LikeLiked by 1 person
Thank you for your suggestion.
But as I told above. I already bought some board. And the product of my boss is use stm32 too.
And for IDE i think that the free edition of keil is good enough for me. Although It’s kind of not good enough in key shortcut. So I only use it for compile my code. I use an IOS IDE name Appcode as editor.
They will have a special edit for C at the end of this year. So I’m good with this.
LikeLike
Good luck on your projects. I hope it works out for you.
Unfortunately, I wasn’t able to use the Keil IDE because the free version is too code size limited. And the cheapest general version was about $3500, if I remember correctly.
LikeLike
Hi Erich,
I just wanted to give a heads up about a cute little board I found today. I expect it will fit on the Freedom boards with Arduino format. It gives 56 GPIO ports.
http://www.emutexlabs.com/13-projects/4-gpio-expander-shield-for-intel-galileo-and-arduino-boards#
LikeLike
Yes, indeed a nice board. I have used so far the NXP PCA9554 I/O expander in several of my projects. I have a Processor Expert component for it too. I prefer it over an SPI based I/O expander it is much easier to be used. Of course, SPI would provide higher speed, but this was not needed for my use cases (checking buttons, toggling relais and LEDs, etc).
LikeLike
hi, was trying to use uTaskerKinetisV1.4.7 with codewarrior and keil for frdm-kl25 given here : http://www.utasker.com/forum/index.php?topic=1721.0
there is also a getting started guide and youtube video : http://youtu.be/uBbiw36Caq4
as instructed i have made changes in config.h file which are necessary to make it work with frdm-kl25
i’m getting build errors
can you pls help me
Thank you
LikeLike
You have posted your question in the right place in the community, and Mark Butcher is very responsive and should be able to help you there.
LikeLike
How do you to view the version of component installed/imported on CW MCU 10.6?
I try any options of views of Components Library and Components Inspector, but without succes…
LikeLike
Hi Antonio,
The component library view does not give you that information. You can see the version of the component in the generated source file (in the header at the beginning):
** Version : Component 01.031, Driver 01.00, CPU db: 3.00.000
Or if you are using CDE/Component Wizard, then it is visible in the component manager, but I assume you do not have/use CDE.
Otherwise, you can check the .bean file (https://github.com/ErichStyger/McuOnEclipse_PEx) and there you have the version:
01.031
LikeLike
Thanks Erich,
the firsts lines on header file is ok!
Good work!
p.s.: waiting with hope for drivers of CC3000 chip TI 🙂
LikeLike
working on it slowly….
LikeLike
MEMORY BUDGET
Hi Erich,
in the old version of CW (tipically for S08, S12 mcu), i remember an utility very good… the amount of memory engaged (RAM and FLASH) by the project under development.
Is possible to activate a particular perspective/view on CW MCU 10.6 (or KDS) to obtain same informations about my (K64F) project?
LikeLike
Hi Antonio,
maybe this one
?
LikeLike
Is not the maximum, but is something…
Thanks!
LikeLike
uint8_t buff[64];
void storeData(){
int i=0;
if (RxBuf_NofElements()!=0) {
SendString((unsigned char*)”stored data is: “, &deviceData);
while (i!=sizeof(buff))
{
unsigned char ch;
(void)RxBuf_Get(&ch);
buff[i]= ch;
i++;
}
SendString(buff, &deviceData);
SendString((unsigned char*)”\r\n”, &deviceData);
}
}
i did it thanks the problem is that
if i write a characters lesss than 64,
eg hjlk
it will write k to fill the array up
hjlkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
which is n ot what i want.
LikeLike
Try Replacing sizeof(buff) with strlen(buff)
better ask this question in a C specific forum!
LikeLike
Hello Erich,
I get this eror from CodeWarrior 10.6, when I try to build FRDM-KL25Z_USB_DCD_Shell and Freedom_UsbCdc.
Description Resource Path Location Type
Generator: FAILURE: Unexpected status of script: Drivers\Kinetis\Kinetis_ProjectInfoXML.drv, please contact Freescale support. Freedom_UsbCdc _PE_ProjectInfo Processor Expert Problem
File Kinetis_ProjectInfoXML.drv was not referenced in .ProcessorExpert.g_c.
It generates elf, but I was just wandering is this some licence problem or some settings.
Thanks,
BR,
Zoran
LikeLike
Hi Zoran,
not, that is not a licensing issue. More of something Processor Expert internally. Are you using my exact projects from GitHub? And do you have any MCU10.6 updates installed?
Erich
LikeLike
Yes, its your projects and your PEupd files from git.
Its just CodeWarrior 10.6:
Installed Products:
– CodeWarrior for MCU
Version: 10.6
Build Id:140329
Part1_Beans_19.09.2014.PEupd
Part2_Beans_19.09.2014.PEupd
I also installed USB_STACK_V4.0.3.exe and Imported that components.
Strange thing is that In Processor Expert view on USB1:FSL_USB_stack it says its v4.0.2.
LikeLike
Now I got USB1:FSL_USB_stack to v4.1.1 (reinstaling Part1_Beans_19.09.2014.PEupd and
Part2_Beans_19.09.2014.PEupd).
But still, I get same “error”.
Its not a big deal, since I get elf file anyway.
Thank you for reply :-).
BR,
Zoran
LikeLike
Ok, there is one way, that it will not display this error:
Build Project>Close Project>Open Project>Build Project>no error
Clean Project>Close Project>Open Project>Build Project>error
Clean Project>Close Project>Open Project>Build Project>Build Project>error
I guess its this CodeWarrior IDE bug.
Thank you, we’ll talk on another page 🙂
LikeLike
Hi Zoran,
I remember that there was an issue with Processor Expert a while back, and it sounds like it is this problem. But for me that problem was fixed in 10.6.
So not sure what is causing this for you.
Erich
LikeLike
Hi Erich
Your blog is really interesting and helpful, tou give really good tips.So, I felt free to ask you if you’ve already worked with TRF7960atb and a FRDM KL25Z. I’m trying to develp the code to connect both devices, but it is really hard for me, since I’m a begginer with codewarrior, and not that much experient with C. Do you have any tips for me?
LikeLiked by 1 person
I don’t know that TRF7960atbf (just looked up in the internet). This board seems to use 3.3V logic levels, so it should not be too difficult to use it with the FRDM-KL25Z board.
LikeLike
I’m trying to compile your blink example for the KL25Z using the included makefile. I’m getting the following error:
/usr/libexec/gcc/arm-none-eabi/ld: LED_Toggle_flash.elf section `.interrupts’ will not fit in region `m_interrupts’
/usr/libexec/gcc/arm-none-eabi/ld: region `m_interrupts’ overflowed by 36 bytes
I’ve looked in the .map file and though I don’t really understand how to read it it appears to be allocating an extra 0x24 bytes for… something… before the vector table.
.interrupts 0x0000000000000024 0xc0
0x0000000000000024 __vector_table = .
0x0000000000000024 . = ALIGN (0x4)
*(.vectortable)
.vectortable 0x0000000000000024 0xc0 ./Project_Settings/Startup_Code/kinetis_sysinit.o
0x0000000000000024 InterruptVector
0x00000000000000e4 . = ALIGN (0x4)
Any thoughts?
LikeLike
It looks like you link the vector table twice?
LikeLike
Hi Erich,
Basic quaestion here, but I need help.
I can’t make your Quadrature component work. Well, I don’t know how exactly use it.
Any sugestion advice?
Thanks in advance.
LikeLike
Basically: The easiest way is to use it in polling mode: assign the two pins, then use a timer interrupt and call the Sample() method from the timer interrupt (or Task).
LikeLike
How i can initialize the MMA8451Q component?, I don´t use a SHELL, and I initialize a I2C_LDD. But I don´t now how to configure the components. You done a great job with this blog, I´m from Mexico and I read every post ;D. Greetings!
LikeLike
Hello,
you don’t need to do much. Have a look at my MMA8451Q processor expert component. From the application side you only need to enable it, and to configure it for FAST or non-FAST mode, that’s it.
Erich
LikeLiked by 1 person
Thanks a lot for your help!!!
Un saludo desde México y …. Feliz Compilación 🙂
LikeLike
I am guessing this is on the Freescale website, but cannot find it anywhere.
Does The Kinetis Design Studio (KDS) have a code limit / licencing model like CodeWarrior (CW)? as the free version of CW (i.e. Special Edition) only allows 128Kb for the K series.
Also as you can install and use the PE component manager / designer as a standalone is there a licencing model attached to this?
Which is the best IDE to use in your opinion?
1) CW – Code size limit
2) KDS – not sure what constraints this has??
3) A self configured Eclipse with PE installed (i.e. Eclipse Kepler and GNU ARM Embedded tool chain)
is there really any reason to use KDS or CW as it is reasonable easy to configure Eclipse Kepler and GNU ARM Embedded tool chain and install PE as you have shown in a blog post.
Thanks
LikeLike
Yes, Kinetis Design Studio has no code size limits. See as well https://mcuoneclipse.com/2014/09/28/comparing-codewarrior-with-kinetis-design-studio/ which gives some pros and cons.
The biggest minus for Kinetis Design Studio are that it is not using the launchpad tools, but you can change that (see https://mcuoneclipse.com/2014/07/11/switching-arm-gnu-tool-chain-and-libraries-in-kinetis-design-studio/).
I would say the best option is 3), but it requires knowledge and time to install, but definitely worthwile. See https://mcuoneclipse.com/2014/05/18/constructing-a-classroom-ide-with-eclipse-for-arm/
LikeLike
Hi,
I have run into an interesting issue with CW 10.6, I have selected the following options in the project properties:
“Create Flash Image”
“Create Extended Listing”
“Print Size”
But when I do a build only the elf file is created and there are no errors displayed in the console window but the flash image is not created nor is the size information created.
I have several other projects that have these options selected and they work fine (i.e. the image is created and the size information printed out in the console).
Can anybody suggest other options to check as this seems like a project properties issue?
Thanks
LikeLike
Hello,
I believe you are having this issue: https://mcuoneclipse.com/2013/06/12/traps-and-pitfalls-no-hexbins19-file-created-with-gnu/
I would check if you have custom options/build settings per file or per folder.
See https://mcuoneclipse.com/2012/07/30/icon-and-label-decorators-in-eclipse/ for the different icon decorators.
I hope this helps,
Erich
LikeLike
Thanks for your help.
i found the file by doing a search for “” in the project file, this helped my find the file in question.
it would be nice if there was a “reset all files” in project instead of having to search for a specific file.
LikeLike
Yes, I agree, such a command like “reset all files” would be nice, but does not exist to my knowledge.
LikeLike
Hi Erich,
Sorry i forgot to ask if there was a way to change the extension used for the generated image?
E.g if srec is selected the image extension is .hex which is not correct.
i am guessing i could change the make file but this would be overwritten on a clean build???
Thanks
LikeLike
The GNU ARM Eclipse plugins (in Kinetis Design Studio and Eclipse Kepler) uses the correct file extension (see https://mcuoneclipse.com/2013/12/23/diy-free-toolchain-for-kinetis-part-7-gnu-arm-eclipse-plugins/).
But it is wrong for CodeWarrior (it always uses .hex extension regardless the file format).
You could use your own post build step as described here:
Another solution is https://mcuoneclipse.com/2012/09/13/s-record-generation-with-gcc-for-armkinetis/#comment-1201
I hope this helps,
Erich
LikeLike
Hi Erich,
I started using a FRDM KL25Z and I would like to thank you because your blog has been helping me a lot!
I’m trying to deal with a 2×16 LCD display and I used your LCDHTA component. I need to go foward and back with the cursor. I saw that the component does not have this function. How could I write a function to make this and add it to the LCDHTA component?
Thanks in advance.
LikeLike
Hi Frederico,
you are welcome!
The easiest way is if you add that function to the code and send it to me, so I can integrate it?
You can generate code, then disable it for the LCDHTA and then modify the code (so it does not get overwritten). See https://mcuoneclipse.com/2012/03/23/disable-my-code-generation/
Thanks for helping adding functionality!
Erich
LikeLike
Hi Erich,
Thank you for answering. It worked.
I send you and e-mail through erich.styger@hslu.ch with the modifications I did and some other wonderings.
Thank you.
Frederico
LikeLike
Hi Frederico,
thanks, got it!
Erich
LikeLike
Hi Erich,
a small question about problem-programming with CW MCU 10.6 (or KDS) over a kinetis mcu (but is a generic problem..):
– is it a method to write into a variable, (but also into flash memory), the time-date of system pc when build the project? I need to know the date-time of last building/flashing to mcu…
LikeLike
You could use the __TIME__ and __DATE__ macros: they tell you when the file was compiled.
I use that in my Shell component, see last screenshot in
where it prints that information for the ‘Firmware’ line.
Both __TIME__ and __DATE__ will be strings defined by the compiler.
LikeLike
Thanks Erich, too good!
LikeLike
We have a project to be designed and quotation.
Pls provide e-mail address that I could be written Inquiry letters.
And do you have Asian area agents may contact ?
LikeLike
You find my address on the About page of this blog: https://mcuoneclipse.com/about/
LikeLike
Hi Erych,
I have an issue modifying my component for the FXOS8700CQ sensor (accel/mag combo). I implemented the use of the internal FIFO but when I don’t want to use the FIFO, I uncheck the box to disable a group with different properties. The problem is, I have references to some properties in my .drv file (to generate the header file) and I don’t know how to remove these references when the box is disabled.
Here is what I’ve done :
#if defined(FIFO_MODE)
#define %’ModuleName’_FIFO_MODE %FIFO_MODE
#endif
But %FIFO_MODE is not defined when I don’t use FIFO so the code generation can’t work.
To you have a simple solution ?
Thanks !!
LikeLike
Not sure if I understand it 100%. But what about this:
%if defined(FIFO_MODE)
#define %’ModuleName’_FIFO_MODE 1 /* use FIFO mode */
%else
#define %’ModuleName’_FIFO_MODE 0 /* no FIFO mode */
%endif
LikeLike
Actually %FIFO_MODE is equal to a value from an enum.
I have a symbol FIFO_ENABLED which is “yes” or “no” when the group is enabled.
So I want to get the value of FIFO_MODE but just when FIFO_ENABLED is equal to “yes”
When equal to “no” the generated code is still looking for the symbol FIFO_MODE but this symbol is not defined.
I hope this is more understandable.
LikeLike
Ok, so here is my next attempt:
%if defined(FIFO_ENABLED) & %FIFO_ENABLED=’yes’ & defined(FIFO_MODE)
#define %’ModuleName’_FIFO_MODE %FIFO_MODE
%endif
LikeLike
But when %FIFO_MODE is not defined, I got the error : Unkown macro: FIFO_MODE
At :
#define %’ModuleName’_FIFO_MODE %FIFO_MODE
LikeLike
No, that should not be the case, because I check in that code if FIFO_MODE is defined (first line, at the end).
So it enters line 2 only if FIFO_MODE is defined.
Have you noticed that I use
%if
and NOT
#if
?
LikeLike
Ah ! that should be my problem !
Thanks
LikeLike
Okay so I got my code clear and it works ! I once noticed this PE feature but didn’t remember about it.
Thanks Erych !
LikeLike
Erich, sorry –‘
LikeLike
So is it solved now?
LikeLike
Yes it is.
Thanks
LikeLike
I have two more small isssues if you have some time to answer directly : https://github.com/fouge/FRDM-FXS-components/issues
Otherwise I would be glad to have documentation about configuring PE component. I read the CDE user manual but this is brief documentation.
LikeLike
I found out how to disable method generation based on a component property in your article : https://mcuoneclipse.com/2013/04/13/extended-driver-for-the-mma8451q-accelerometer/
Thanks 🙂
LikeLike
I fixed both issues. Sorry for spamming, and thank you for your implicit help !
LikeLike
no worries 🙂
LikeLike
Primarily, thank you for your library. I tried run TFT screen that driving with ili9341 but i coudn’t. Do you plain any tutorial for TFT screen or what must i do ?
Thank you for everyting .
LikeLike
I don’t have a specific tutorial for this, and I don’t know that ili9341. But you might have a look that the existin display drivers available in the McuOnEclipse components?
LikeLike
Hello again Erich, I’m currently using the mbed system to program some KL25 and Nucleo boards hopefully with the prospect of making a commercial product. Are the Freedom boards able to be used in applications where you sell them or are they for evaluation purposes only. I don’t really want to get too involved in the hardware side and hope to just fit shields and sensors to a ready made platform. I’ve asked this question on mbed but thought I’ld ask a guru as well.
Cheers
Mike
LikeLike
Hi Mike,
Personally, I would not use the FRDM boards for a commercial product. The boards are for evaluation purposes. Sure you can use them for a small batch of ‘proof of conecpt’ boards (I did the same), but if you are going after >20 or >50 boards you probably are better positioned with your own board: you can make it smaller, have only the components on it you need, and you can provide proper warranty. Keep in mind that for a commercial product you need to comply with rules and regulations (CE, safety, etc) too. Same thing applies to other boards like Raspberry and BeagleBone. I know that especially the BeagleBone is used for commercial products, because that board is much more complex and difficult to produce yourself. The FRDM board is really, really simple compared to that one. The other thing you need to keep in mind with evaluation boards is that they might change or not be available any more. So what happens if you need to deliver 500 for your products and cannot get them? But again, for a small batch: why not. For everything else you need to think about doing things differently.
I hope this helps?
Erich
LikeLike
I love the BeagleBone Black. For $55 US you get a complete industrial Linux computer with lots of IOs, and which fits into an Altoids tin. It also has lots of add-on boards (capes – named after the “cape” that Underdog wore).
I expect it will be a market leader for the next year or two and hang around for years to come.
Who can guess what will come after that? A Linux, Mac, and Windows computer with monitor and 1 Tbyte ramdrive that you wear on your wrist and comunicate with via Bluetooth enabled brainwaves?
Then 3 years later, perhaps an implantable computer that not only lets you communicate via the Internet of things, but has the capacity moderate ones neurotransmitters and body hormones, and connect everyone to a central world government computer?
Oops. No, wait. That’s from a story I just read.
😉
LikeLike
Yes, I love my BeagleBone Black too. It is just that I did not had much time to play with it. The BeableBone board is small, inexpensive and has a lot of processing power. It is so good that I see companies buying many boards, and some vendors restrict orders that you only can order one board at a time. Because the boards are so popular, other vendors have started to manufacture them to fullfil the needs. Definitely an interesting board. There are already some small implantable computers available today, but not to the masses in 3 years 🙂
LikeLike
Can I program a KL17 from a frdm-kl43z board using the PE opensda code, or do I need some other solution?
LikeLike
Hi Steve,
no, this does not work: the P&E OpenSDA on your FRDM board only can talk to the device (same UUID) on your FRDM board.
But you *can* use it to program another board (not debug), see https://mcuoneclipse.com/2013/04/21/using-the-freedom-board-as-jtag-programmer/
If you want to debug another board, you need to use a firmware like USBDM (see https://mcuoneclipse.com/2013/04/27/debug-external-processors-with-usbdm-and-freedom-board/)
LikeLike
Is there a tutorial or a example project detailing the application of the Shell (as opposed to FSShell) component?
LikeLike
Hi Gene,
all my examples on GitHub (https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples) with Shell are using the new Shell. See https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples
LikeLike
I have used a few components from MCUoneclipse and would like to look at and possibly modify the PID component source. Before jumping into the CDE I wanted to ask if this is allowed and if there is tutorial on this?
Thanks
LikeLike
Hi dale,
yes, this is allowed and even encouraged :-). I do not have a tutorial on PID. If you are asking about a tutorial on CDE, there is one here:
However, all the components on this site have been created with the previous ‘BeanWizard’, because the Eclipse based CDE was not compatible with the older components (or even corrupt the components).
So be free changing things, but if you contribute back, we need to be careful not to break anything.
Erich
LikeLike
Hi Erich,
i tried your ssd1289 component but i coudnt found pin conf. for parallel comminucation (ex RS, D0..D15)
Thank you for help and your blog
LikeLike
Hi C. Emre OZ,
I have implemented the parallel bus interface only for Coldfire and the FlexBus, and not for a general parallel interface.
Erich
LikeLike
Hi Erich
I try to use KDS build a MK22FN128xxx12 project with PE.
But I have to enable KSDK when I want to use PE.
If I choose MK22FN256xxx12, I can only use PE without KSDK.
What is going on KDS?
LikeLike
Hi Kyle,
Freescale only supports that device with the Kinetis SDK, and only with Processor Expert components for the SDK. So you cannot only select PE, you are forced to use the SDK 😦 .
LikeLike
Hi Erich
Thanks, I hope I can handle that.
I am trying to use freeRTOS with low power timer.
And I got some compiler message as below.
“fatal error: IO_Map.h: No such file or directory”
But I can not find the “IO_Map.h” file from KDS or KSDK.
#if configSYSTICK_USE_LOW_POWER_TIMER
#include “IO_Map.h”
#include “SIM_PDD.h”
#endif
LikeLike
Hi Kyle,
are you using my example from https://mcuoneclipse.com/2013/07/06/low-power-with-freertos-tickless-idle-mode/ ?
Erich
LikeLike
Hi Erich
I using “FRDM-KL25Z_FreeRTOS” example and enable low power timer.
I can see this two head files generated.
But in my K22 project, this files did not generated.
LikeLike
I think for the K22 project you have the Kinetis SDK enabled? If so, the Kinetis SDK is using a different driver model.
LikeLike
Hi Erich
Yes, when I create my K22 project with PE.
The KSDK must to enable if I want to use PE.
But I need to use low power mode with LPMR module.
So, I have to enable low power timer.
What can I include to solve this issue?
LikeLike
You need to install an update (see https://mcuoneclipse.com/2014/12/27/usb-with-the-freescale-frdm-k22f-board/) in order to create K22F projects without the SDK.
LikeLike
Hi Erich
I have install this update before.
But when I create K22F, still need SDK + PE.
My selection is MK22F128xxx12.
LikeLike
hmm, then I don’t know. It looks that this update does not apply to that K22F128xxx12 device 😦
LikeLike
Hi Erich
May I choose MK22FN256xxx12 for development first?
Basically, the different between MK22FN128 and MK22FN256 is the flash size and package.
LikeLike
yes, that would be an option.
LikeLike
Hi Erich
I refer your tutorial regarding PE + KSDK.
After I create the K64F project, there is a OS name “osa1:fsl_os_abstraction” in the OSs folder.
My KDS version is 2.0 and KSDK is 1.1.
LikeLike
Hi Kyle,
there is a standard ‘OS’ abstraction level included even if you are not using an OS. Think about an OS abstraction for bare metal.
Erich
LikeLike