Author Topic: Three problems with CW10 KL46 demo.  (Read 11839 times)

Offline Ian

  • Newbie
  • *
  • Posts: 5
    • View Profile
Three problems with CW10 KL46 demo.
« on: May 07, 2014, 03:21:31 PM »
Hello,
I am having three problems with the demo for the FRDM-KL46 board described here:
µTasker Quick Start Video Guide for Kinetis and Codewarrior 10.5.

All problems are related to the tools or OS, not the code.
1) I can't find the linker file described in the video: "KL_256_32.ld"  I found all the other ones including "KL_128_16.ld" for the smaller part.  Does this exist somewhere else in the installed projects?

2) The .bin and .srec files are not generated because the "generate.bat" has no path set to the compiler tools.
arm-none-eabi-objcopy  --output-target=binary uTaskerV1_4.elf uTasker_V1.4.bin
arm-none-eabi-objcopy  --output-target=srec uTaskerV1_4.elf uTasker_V1.4.srec

I am using a fresh install of Win 8.1.  What is the best way resolve this?

3) CW doesn't recognize the USB interface on the FRDM-KL46 board as an openSDA interface so I can't run the debugger (and probably the flash programmer if I could generate the .bin file). It does innumerate as an MSD device.  I expect there is something obvious I am missing...  Anybody have any idea's or best way to approach?

Thanks in advance,
Ian

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: Three problems with CW10 KL46 demo.
« Reply #1 on: May 07, 2014, 03:50:06 PM »
Hi Ian

1. You will find all linker script files in \Applications\uTaskerV1.4\KinetisCodeWarrior\Linker_Files but if you don't have the latest version V1.4.5 there may still be some missing. They are easy to create though - it is just the RAM and Flash settings that need to be adjusted. I have attached the KL_256_32.ld that I have.

2. What I have done in the lastest version is pass the tool patch to the BAT file using
..\generate.bat "${ARM_GNU_TOOLS_HOME}/bin"
In the bat file I have
set toolpath=%1
%toolpath%\arm-none-eabi-objcopy  --output-target=binary uTaskerV1_4.elf uTasker_V1.4.bin
%toolpath%\arm-none-eabi-objcopy  --output-target=srec uTaskerV1_4.elf uTasker_V1.4.srec
%toolpath%\arm-none-eabi-objcopy  --output-target=ihex uTaskerV1_4.elf uTasker_V1.4.hex


This ensures that the same tools are used as by CW and also doesn't require the PC to have a path setting for this.

In the stand-along GCC build I simply add a path in the bat file itself:
SET PATH=%PATH%;C:/Program Files/CodeSourcery/Sourcery G++ Lite/bin
In this case you need to know where the build tools are located and modify the bat file, but this has to be done only once.

Unfortunately I couldn't get the tool path passing to work in the new KDS (it doesn't seem to allow using path variables in the parameter passing process) so it is also necessary to set the local path manually at the moment (if not already set in the PC's path variables, where it can also be manually added).

3. The Freedom boards tend to be delivered with a MSD loader installed but not the debugger (not very logical). To install the OpenSDA debugger you can follow the guide here:
http://www.pemicro.com/opensda/
In the firmware Apps zip file there are lots of OpenSDA debugger images for all FRDM boards and just set the KRDM-KL46 to the boot loader mode by powering it with the loader switch held down, then drag the corresponding file, "MSD-DEBUG-FRDM-KL46Z48M_Pemicro_v114.SDA" is the one I used, to it (it appears as hard drive). Then restart the board and you should be able to connect/load/debug.
I had to do this with all of the FRDM boards that I worked with, apart from the new FRDM-K64F which has a different variation...

Good luck

Regards

Mark



Regards

Mark





Offline Ian

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Three problems with CW10 KL46 demo.
« Reply #2 on: May 07, 2014, 09:08:01 PM »
Thanks Mark! Lots of detail made it quick and simple.  Now I am stuck just after #3.  The P&E Connection Assistant window pops up showing:

OpenSDA on USB1 (Name=...) (Autodetected)

but also the message

"An error occurred while connecting to the interface hardware or target specified in the Launch Configuration Dialog."

I really expected it to just work!  I think I must be missing something in the configuration of the debug connection.  Any more thoughts on this issue?

Ian

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: Three problems with CW10 KL46 demo.
« Reply #3 on: May 07, 2014, 09:53:31 PM »
Hi Ian

Which version of CW10.x are you using (I use 10.5). In my version I can set up a debugger connection for the board as follows:

1. Build the target that you want to load/debug - eg. "uTaskerV1.4_FLASH"
2. In the menu "Run | Debug Configuration..." double-click on "CodeWarrior" and it will make a run configuration with the name "uTaskerV1_4 uTaskerV1.4_FLASH" (or similar).
3. In the settings for 'main' check that the project path is pointing to the elf file that was created (eg. "Applications\uTaskerV1.4\KinetisCodeWarrior\uTaskerV1.4_FLASH\uTaskerV1_4.elf")
4. Ensure that "Download" session is selected (this will load the code to flash rather than just connecting, for which "Attach" is good when the code is already loaded and you just want to debug existing code)
5. You will need to add a target setting, whereby it should be possible to choose between 3 that are pre-defined in the project by selecting from the the drop down list - select "uTaskerV1.4_FLASH_SDA" assuming that it hasn't been lost during the import. Then select "Edit..." and verify that it's connection type is "P&E ARM Multiline\Multilink Universal\Cyclone Max\OSJTAG" and that "Use SWD reduced pin protocol for communication" is selected.
6. Next to the target (openSDA) select "Edit..." and verify that the "Target Type" matches the processor "KL46Z256M4"
7. Close the windows with save/apply where relevant and click on "Debug" to open the connection (and download the code)

The details may change slightly between CW versions and the process is quite frightening because it is complicated and can be done in various different ways due to the fact that Eclipse is so versatile. And one still has to keep one's fingers crossed since one never know exactly what it is doing and whether it will really work. But by doing these steps all works well for me.

Unfortunately, if one needs something that just works (with only a few simple basic configurations where is is quite clear what is happening one needs something like IAR). However, with a bit of patience, sometimes some trial and error, and sometimes some searching in the Internet it should be possible to solve all problems and then start using it for real work.

Regards

Mark


Offline Ian

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Three problems with CW10 KL46 demo.
« Reply #4 on: May 09, 2014, 03:57:39 PM »
Hi Mark - I'm nearly there.  It is compiling, downloading, running and enumerating as a mouse. The green LED flashes and the LCD shows USb.  It just doesn't work as a mouse - no cursor movement and no effect from the buttons.  I followed the directions in the video twice and each time have the same result. 

Can you suggest how the debug? Using CW10.6.

Ian

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: Three problems with CW10 KL46 demo.
« Reply #5 on: May 09, 2014, 07:41:59 PM »
Ian

There are are few configurations to check (the settings may not be the same as the project shown in the video):
1 - that USB (USB_INTERFACE) and the mouse functionality (USE_USB_HID_MOUSE) are enable. These will be since you already get enumeration as as mouse.
2 - that IIC_INTERFACE is enabled because it will use the accelerometer on the board to generate 'tilt' values to move the mouse and that accelerometer TEST_MMA8451Q is enabled in iic_tests.h.
3 - in addition, make sure that TEST_PWM is disabled in ADC_Timers.h (I just tried and the button didn't react due to the fact that this is using the pin as a PWM output signal and not as an input when the PWM test is enabled).

Note that the 'tilt-mouse' is very crude and its algorithm very simple so it is difficult to actually control the cursor with it. The idea was more to enable a very simple way to see that the accelerometer can be read (via I2C at about 400 samples a second) without needing the UART as output. If anyone is interested I am sure that, based on the x,y,z information a 'proper' air-mouse could be created but that is why I didn't dare call it an "air-mouse" since it is very simplistic.... However I can move the cursor when I build like this.

To check the accelerometer (in case that is failing) you could do the following:
- connect to the OpenSDA virtual COM (connected to the debug UART on the board) and enable accelerometer data output in the I2C menu (menu 7) with "acc_on" and then the values are displayed about 4x a second and the x,y,z values should change as the board's angle is changed. Turn off the output with "acc_off".

You could also try enabling USB-CDC rather than the mouse. In this case you can connect to the USB as a virtual COM port (like the OpenSDA can do to the UART). The same menu can be controlled and the accelerometer output enabled and disabled. The USB CDC driver is in \Applications\uTaskerV1.4\USB if you haven't already installed it.

I don't think that there is much point trying to debug before checking the basic operation/options above first. I have also attached a binary that I just build and tested so that you can identify a HW issue from a configuration/build issue. Note that you can simply drop the binary to the debugger's USB-MSD loader to program it (when the board appears as FRDM-KL46Z hard-drive).

Regards

Mark


Offline Ian

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Three problems with CW10 KL46 demo.
« Reply #6 on: May 10, 2014, 03:19:57 PM »
HI Mark, thanks for your help with this.  The problem appears to be the I2C isn't enabled somewhere (IIC_INTERFACE  *IS* defined in config.h) Menu item 7 from the debug uart only has "up" and "quit" as options.  It's not critical that I get this working if it is only a config problem.

I have have moved on to the TWR-K60 demo.  I can get it to build, and it runs properly on the simulator ( which is quite impressive), but the htm pages don't show in the browser. I get "uTasker - Error 404".  They do work when running the simulator.  "dir" show that all the files are there on the SDCARD.  Something simple missing...?

Ian

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: Three problems with CW10 KL46 demo.
« Reply #7 on: May 11, 2014, 12:40:05 AM »
Ian


The I2C menu item was added in  V1.4.5 (debug.c    03.05.2014 Add accelerometer debug out enable                        {68}) so possibly you are using V1.4.4 where the menu is empty(?). [In V1.4.4 there is a define (DISPLAY_ACCELEROMETER_VALUES) in iic_test.h to enable the debug output, which is however not as practical as in V1.4.5 since it can't be stopped] In any case I have tested the I2C interface and accelerometer on just about all boards and they all worked correctly (the I2C interface is compatible between KL and K parts so nothing special had to be done) so I expect a local problem in this case. You can in fact use the same configuration on the K60 and verify that it works there if needed since it also has the accelerometer.

If you are working without the SD card or the SD card is not inserted (K60),  the web server will work with the internal file system - in this case you can program the files in "Applications\uTaskerV1.4\WebPages\WebPagesKinetis" using the "Copy_all.bat" or manually via FTP.

When the SD card support is enabled and the SD card is inserted the web server will look in the directory #define HTTP_ROOT              "dir1"
and on first connection serve the page #define DEFAULT_HTTP_FILE      "index.htm"
Usually one puts more complicated web pages on the SD card but if you use the ones above you can change this so that it defaults to 0Menu.htm

Do you see the files in the directory when you look using FTP or the command line interface (or USB-MSD when configured with it) [I think you already answered this though]? You can also try directly displaying a web page using the complete file path (in the Browser) eg. 192.168.0.3/0main.htm or another page or image.

Possibly, when you used the simulator the simulated SD card was not inserted (or was not formated) so it served from internal Flash, which matches with the tutorial case, but on the HW you have a formatted SD card inserted so it looks in the other place and so behaves differently(?). You should find that the HW and simulator agree exactly in such cases.

Regards

Mark
« Last Edit: May 11, 2014, 12:45:38 AM by mark »

Offline Ian

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Three problems with CW10 KL46 demo.
« Reply #8 on: May 13, 2014, 04:10:21 PM »
Thanks.  I have the TWR-K60 demo going.  The problem was the .htm files were installed in the root directory and the server expected them in "dir1".  So that is fixed.

Last problem - Simple one:

When I load the uTaskerKinetisV1.4.5  project into CW10.6, I get this message at startup:
    References to ${workspace_loc:<resource>} macro were found in project settings.
    Using this macro could cause unexpected errors when the resource is not open or available.. 
    Using the ${ProjDirPath}  macro is preferable.

Then the following errors in the problems window-
    Program "g++" not found in path
    Program "gcc" not found in path 

Program "g++" not found in PATH   Project Properties, C++ Preprocessor Include.../Providers, [CDT GCC Built-in Compiler Settings Cross ARM] options        C/C++ Scanner Discovery Problem


I have compared the v_1.4.4 and the v1.4.5 projects and can't find any difference.

Ian

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: Three problems with CW10 KL46 demo.
« Reply #9 on: May 13, 2014, 04:48:42 PM »
Hi Ian

V1.4.5 has support for the new KDS (Freescale Design Studio). CW and KDS are Eclipse based and both (as well as Atollic) want their project files to be in the project root. Due to the new stuff, the KDS is set as default and so opening with CW (as delivered) may cause various strange effects.

See the release note (section copied here) for instructions for setting CW10.x project:

Quote
- KDS (Kinetis Design Studio) support added.
IMPORTANT: This release is configured by default for the FRDM-K64F and so can be imported directly into KDS. To work with CodeWarrior copy the Eclipse project files from \Applications\uTaskerV1.4\KinetisCodeWarrior\ProjectSettings to the project root directory after removing the KDS ones from that location; switch between CW10.x, KDS and Atollic using the same method - there is a corresponding set of Eclipse project files in:
- \Applications\uTaskerV1.4\KinetisDesignStudio\Project_Settings
- \Applications\uTaskerV1.4\KinetisCodeWarrior\ProjectSettings
- \Applications\uTaskerV1.4\KinetisAtollic\Project_Settings
It is recommended to keep a backup of these settings when switching between IDEs in case one environment corrupts the setting of others.

Regards

Mark