Hi all,
i've bought the freedom freescale and is the first ARM mcu i've ever bought.
I've vorked only with ATmel and Pic microcontrollers and i used to easily found datasheet with registers and single bit explanation in order to better understand the MCU and work with it without IDEs like codewarrior.
There is any datasheet like it? the only datasheet i can found is only 50-60 pages....
another simple question.....what you use to program the freedom? there is any "free library" like the one for atmel microcontrollers for ARM MCU?
There is not current a "Wiring" framework for the Freedom yet, but I am working on it.
(Many do not realize it, but the Arduino API is actually the based on the Wiring Framework)
Extended Framework (API) \ Wiring
You will will now have an 800+ document, that at first will be, well some what overwhelming.
I suggest for now you learn how the use Processor Expert (aka PE), as you will first need to approach this at a high level.
Erich has some excellent tutorials for PE.
The KL25 is based on ARM M0+, which in turn is based on ArmV6, so you may wish to google these documents:
DDI0484B_cortex_m0p_r0p0_trm.pdf - Cortex-M0+ Technical Reference Manual
and
DDI0419C_arm_architecture_v6m_reference_manual.pdf - ARMv6-M Architecture Reference Manual
Freescale does not fully explain the architecture as it is based on these documents.
You also may wish to try out Keil uVision MDK which is free up to 32K. I prefer Codewarrior, but right now 10.3 is in beta has issues that are blocking me. MDK 100% supports the OpenSDA and the Freedom board.
Hello,
see the reference manual(s) on KL2 Product Summary Page.
Or this direct link:
http://cache.freescale.com/files/32bit/doc/ref_manual/KL24P80M48SF0RM.pdf?fpsp=1
If you are using CodeWarrior with the Freedom board (see CodeWarrior for MCU10.3 beta is now available | MCU on Eclipse), then you have brief bit-by-bit description in the debugger:
As for programming: CodeWarrior is free (in the special edition there is a code size limitation, but 10.3beta has no code size limitation for ARM and gcc).
The Freedom Board comes with OpenSDA which is free as well: you can program the board using the OpenSDA MSD Bootloader even without a debugger: simply plug in the board and drag&drop the S19 file. See OpenSDA on the Freedom KL25Z Board | MCU on Eclipse. You can use that interface as well to debug your Freedom board.
Hope this helps,
Erich
Hello Erich,
I've just now joined the community and am unfamiliar with the interface so please bear with. This is the first 'social network' in which I want to participate seriously. My background: started in 1978 with 6502 then 6809 then 6811. Created my own IDE with VisualBasic to wrap a low cost command line C compiler from Imagecraft. VB is dead so I'm trying Python but time is short and now that I have CodeWarrior I'll probably stop.
I bought a couple of Freedom boards last week, installed CW10.3b (wow!) and started exploring the system. (A pair because I intend to equip them with radio transceivers (can you recommend cheap 100meter units?). Good grief there's a lot of reading. Are there printed versions (books) of the CW and KL25Z documents available (like M68HC11RM/AD and M68HC11PM/AD were for the 6811)?
Nevertheless, I believe I am making good progress. Have been able to run helloworld, accelerometer_demo, pwm_led and created my own bareboard project to explore ProcessorExpert (with which I am very impressed as dabbled with creating something similar for the 6811).
Last question: Somewhere in the documentation it mentions a problem with getchar() and I see in pwm_led the workaround using uart_getchar. When I add this to helloworld...
printf("\n\n\n\n\nPress any key to start!");
InpData[0] = uart_getchar(TERM_PORT_NUM);
...and run, the printed material does not appear on the terminal until after uart_getchar returns. My theory is that the processor is busy waiting for the RDRF flag to set so the printing is stopped. But this doesn't make sense because printf should complete before getchar runs. Does printf use DMA? and if so why should the DMA suspend when the RDRF is being polled? Am I missing something? Also when I try to use uart_getchar in my own project it hangs.
Because I am unfamiliar with this community interface would you be so kind as to also email me at drgenge@telus.net
Thanks very much.
Cheers,
Dave
"ceterum censio printf() delendam esse" (Carthago delenda est - Wikipedia, the free encyclopedia) what I always would say about using printf() (and variants). They are really not intended for embedded :-).
Seriously, printf() behaviour depends on the library buffering. ANSI defines several ways, and one is that the buffer only get flushed if there is a \n at the end.
Add a \n at the end of your printf() call, and things should be fine.
Even worse: so the buffering/implementation of printf() is not the same from vendor to vendor, so depending on which compiler/library you use, things are different.
These kind of things are the reason why I never use printf(): I use my own routines instead (through Processor Expert).
Hope this helps,
Erich
Thanks Erich. That was very helpful.
I deleted CsIO1:ConsoleIO from Components,
added AS1:AsynchroSerial,
called RecvChar and SendChar functions in AsynchroSerial
from functions I wrote: InChar, Outchar and OutString
As a first approximation they're crude but for simple character IO work just fine.
(Did have to include a LineFeed character detector so a Return character could be added to the output to get proper formatting in CW Terminal window). Code looks like this...
char InChar(void){
char c;
while(ERR_RXEMPTY == AS1_RecvChar(&c)); // wait for receive buffer to be filled
return c;
}
void OutChar(char c){
while(ERR_TXFULL == AS1_SendChar(c)); // wait for transmit buffer to be empty
void OutString(char *c){ |
while( *c ){
switch( *c ){
case 10:
case 13:
OutChar(13); OutChar(10); break; // 13 is Return character 10 is LineFeed character
default:
OutChar(*c);
}
c++;
}
}