FRDM-KL46Z

I am trying out this board by mbed.

Though I know that this one is not among those official supported platforms, it works at some degree. Those two leds can work, and MMA8451Q works, and MAG3110 works, and Light Sensor works as well. However, the 4-digit LCD did not.

The most strangest thing is that: I can compile the program and downloaded it to KL46Z but an error message will come out whenever I tried to access any one of those pins others than the aforementioned components' pins.

The error message is: pinmap is not found!

I tried to edit the PinNames.h file of KL25Z to fit it to KL46Z, but it did not work. But, it is curious why leds, MMA8451Q, MAG3110 and light sensor work?

Maybe the details hide in those assembly files, who knows?

Still scratching my head!

2014/2/14

Now, mbed has officially suppported this platform and it just works fine with the mbed and mbed-src libs. And the link to my code is as follows:

Import programKL46Z

FRDM-KL46Z pinmap is different from KL25Z

I have a Nokia 6100 LCD shield with a 9 bits SPI interface, later I will try out the software SPI suggested by Erik since KL25Z and KL46Z support only 8 and 16 bits SPI modes.


Report

32 comments on FRDM-KL46Z:

17 Oct 2013

Hello JP Pang,

what are you trying to achieve? KL46 is not supported yet, neither on github (fully). Some peripherals are different than on KL25Z, therefore they don't work for you.

I am currently fixing CMSIS files and peripherals.

Regards, 0xc0170

17 Oct 2013

Hi Martin,

I appreciated your comment.

It did not work 100%, and I know this board is not among the officially supported platforms. I just want to give it a try.

Could you give me some hints? I got this "pinmap is not found" error message whenever I want to access pins other than those pins of components I mentioned above.

With kind regards,

jppang

18 Oct 2013

Hello JP PANG,

I pushed yesterday my branch, where I fixed CMSIS files for KL46Z, SPI is not yet functional and some peripherals are not tested. DO you know how to work with mbed & github? You can help me to make this port work and then it can be added to official platforms.

link: https://github.com/0xc0170/mbed/tree/dev_kl46z

Regards,
0xc0170

18 Oct 2013

Hi Martin,

Thanks for your feedback.

Later, I will give it a try.

With kind regards,

jppang

18 Oct 2013

Hi Martin,

I have imported the mbed-src which includes MKL46Z4 library. Could you show me how to let mbed online compiler knows this target?

With kind regards,

jppang

06 Feb 2014

Hello Jppang-

did you ever get this module working properly from the mbed online compiler?

Are you finding it compatible with the other mbed features like the CMSIS-DAP debugger?

07 Feb 2014

Hi Greg,

I did have the board work by using the online compiler recently. Those components that worked are TSISensor, 8451Q, 3110 and LEDs. But after I update the mbed libraries yesterday those components fail to work, although the compiling process was successful.

I did some debugging by using the blinky example with the updated libraries, it works. Debugging is ongoing.

With kind regards,

jppang

07 Feb 2014

Greg Ladwig wrote:

Hello Jppang-

did you ever get this module working properly from the mbed online compiler?

Are you finding it compatible with the other mbed features like the CMSIS-DAP debugger?

Hello greg,

what problems are you having? If any, create a question where we can help you. CMSIS-DAP for KL46Z board is shared on mbed, so it's supported. Also the board in the online compiler. KL46Z was used in hackaton in January for example.

Regards,
0xc0170

07 Feb 2014

@JP Pang,

Did you use the mbed library, or mbed-src? Were they the latest version? If they weren't the latest version, could you update it? If you used the mbed lib, could you delete it and try mbed-src? (http://mbed.org/users/mbed_official/code/mbed-src/). If you used mbed-src, could you delete it and try mbed?

I had a very quick look at it: Flashing LED works fine for me (on mbed and mbed-src). TSI using your library didn't do anything on both, but then I tried accelerometer: worked fine, on the red LED (again both with mbed and mbed-src). Green LED doesn't do any PWM. And since it is both the case with regular mbed and mbed-src, it probably isn't my mistake :D. It also doesn't give an error, so it should support PWM, but it doesn't. But in principle it seems to work to me.

Edit: Really quickly checked source, only red LED is PWM capable. So that is expected, but I don't get the mbed error message (PinMap not found). Which is a bit weird, but okay.

07 Feb 2014

Hi Erik,

For the FRDM-KL46Z board, I used the mbed-src for months and kept no change till two or three days ago. After I updated the mbed-src, the code can be compiled successfully however it failed to work. Then I deleted the mbed-src and imported the mbed lib, the symptom is same.

I also imported the simple blinky led example and gave it a try, it works for both red and green leds though it uses DigitalOut not PwmOut.

My code is listed as following.

main.c

#include "mbed.h"
#include "TSISensor.h"
#include "MMA8451Q.h"
#include "MAG3110.h"
#include "vfnLCD.h"
#include <cstdlib>
#include <iostream>

Serial pc(USBTX, USBRX);

TSISensor tsi;
MMA8451Q acc(PTE25, PTE24, 0x1D<<1);
MAG3110 mag(PTE25, PTE24, 0x0E<<1);
vfnLCD lcd;

PwmOut rled(PTE29);
PwmOut gled(PTD5);
AnalogIn lightSensor(PTE22);
DigitalIn s1(PTC3);
DigitalIn s3(PTC12);


int main()
{
    using namespace std;

  //  float onTime = 1.0;
 //   float offTime = 0.0;
    float holdTime = 1.0;
    int magX = 0, magY = 0, magZ = 0;
   

    while(1) {

        rled = abs(acc.getAccX());
        gled = abs(acc.getAccY());
        mag.getValues(&magX, &magY, &magZ);
        lcd.vfnLCD_All_Segments_ON();

        cout << "MMA8451: " << acc.getAccX() << "\t" << acc.getAccY() << "\t" << acc.getAccZ() << "\n\r" << endl;
        cout << "MAG3110: " << magX << "\t" << magY << "\t" << magZ << "\n\r" << endl;
        cout << "MAG3110: " << mag.getHeading() << "\n\r" << endl;
        wait(holdTime);

        rled = tsi.readPercentage();
        gled = tsi.readPercentage();
        lcd.vfnLCD_All_Segments_OFF();

        cout << "Touch: " << tsi.readPercentage() << "\n\r" << endl;
        cout << "SW1: " << s1 << "\n\r" << endl;
        cout << "SW3: " << s3 << "\n\r" << endl;
        cout << "Light Sensor: " << lightSensor << "\n\r" << endl;
        wait(holdTime);
    }
}

And the blinky example is listed as following.

Blinky LED main.c

#include "mbed.h"
#include <iostream>

DigitalOut myled(LED2);

int main() {
    using namespace std;
    
    while(1) {
        myled = 1;
        wait(0.2);
        myled = 0;
        wait(0.2);
        cout << "this is a test" << "\n\r" << endl;
    }
}

07 Feb 2014

I checked the datasheet, and the green LED should be able to support PWM, so that can be added. However I don't think the mbed library every had it included, looking at older revisions.

When you say it fails to work, what do you mean? Doesn't it do anything at all?

07 Feb 2014

Hi Erik,

"Fails to work" means that leds did not blink, 8451/3110/TSISensor/LightSensor did not report their readings to TeraTerm. I can not debug the board now because I leave it at my working place.

07 Feb 2014

Can you publish the program and share a link to it?

07 Feb 2014

I assume it is based on this: https://mbed.org/users/highroads/code/FRDM_KL46Z_LCD/

Now I imported it, and it indeed does very little. Did some testing, and it was that library, importing it is enough to make sure nothing happens. Removing it (and fixing some other things, like SW1 and SW3 are now pin names, and I didn't test the mag library, but I did have the accelerometer on it, also the analogout pinmap is not found), and then it runs fine.

If you do want to use the LCD display, I just verified that http://mbed.org/users/star297/code/FRDM-KL46Z-LCD-rtc-Demo/ still works fine. Based on the same freescale code, but it doesn't lock up the mbed, which is always a good point. (Btw get the initial message it displays from the source code, Paul has been a bit optimistic about how good you can read text on the display).

So now only someone got to check that green LED pwm.

And @ Sam, now you can't hide ;). First of all, changing mbed-src revisions takes ages. Now I know it is a very large one, but I don't remember it taking so long before. And are you guys looking into the LPC1768s GPIO speed?

08 Feb 2014

Hi Sam,

Here is the link to my code.

Import programKL46Z

FRDM-KL46Z pinmap is different from KL25Z

08 Feb 2014

Hi Erik,

I had tried a couple of isolation debuggings with the updated mbed lib. By commenting out those components one by one, I found those components' libs are not the root cause. I believe that the updated mbed lib is weird for KL46Z.

08 Feb 2014

Found some typos in PinMap_PWM and submitted a patch. Also added default handler for NMI_b. https://github.com/mbedmicro/mbed/pull/160

@Erik - Working on the LPC1768 GPIO speed ;)

08 Feb 2014

@Sam, also like the default NMI handler, that one has caused quite some problems for some people :)

@Pang, I tried it with your program, but I really found out the same as what I wrote before: It works fine, as long as the lcd lib is not there. Here I exported it with as only change removing the LCD lib: http://mbed.org/users/Sissors/code/KL46Z/. Note, only commenting it out is not sufficient, it really needs to be removed (And you might need compile all).

I would have a look at that mag library though if I were you, it returns values depening on how I hold my board, but I don't think it is correct ;).

Normally I wouldn't mind trying to figure out how it locks up the mbed (just by being there), but there is another library for the same component, based on the same code, which works fine. That one also has less code left in which isn't required anymore (for example the LCDs interrupt code is removed from that one, the one you have included still has it), which causes me to assume it is just something left over in the code there which shouldn't be there.

08 Feb 2014

Hi Erik,

Thanks for your advice. I will give it a try after I get back to office.

Did you know is there any lcd lib available and workable for the KL46Z board?

08 Feb 2014

This one works according to my tests: http://mbed.org/users/star297/code/FRDM-KL46Z-LCD-rtc-Demo/ (that is the helloworld of the program, it includes the lib).

08 Feb 2014

Hi Erik,

Many thanks!

Again, I will give it a try after I get back to office.

10 Feb 2014

Hi Erik,

After I deleting the vfnLCD lib, the board gets back to work!

Thanks for your double checking.

BTW, I will try out your suggested LCD lib later.

With kind regards,

jppang

10 Feb 2014

I too have verified this works:

http://mbed.org/users/star297/code/FRDM-KL46Z-LCD-rtc-Demo/

Different subject:

Does anyone know if mbed is working on an export to uVision for this board?

11 Feb 2014

Hi Erik,

I tested the SLCD lib, and it works!

Many thanks.

11 Feb 2014

Hey guys- what are you using for debugger?

11 Feb 2014

Nothing :D

I just use printfs. But it should be possible to debug it with integrated CMSIS-DAP and a random toolchain. I think.

11 Feb 2014

hmmm.... mbed has the 'support' for CMSIS_DAP for this board but I would really like to see the compiler take care of all the nasties to export it to uVision....not implemented yet.

11 Feb 2014

Exporters for uVision and GCC ARM Embedded should be in place. Can you confirm that in the IDE, when you select a program, click and choose export does it not give you options for uVision, GCC ARM Embedded, mbed tools and Zip Archive?

11 Feb 2014

/media/uploads/gjladwig/export.bmp

The IDE knows about it but clicking on "export" brings up the error dialog.

11 Feb 2014

Hello Greg, first of all , if you have any issues, please start a new thread which would be dedicated to it.

I exported a simple application for KL46Z to uvisiion, no error, using the latest mbed-src. Please update mbed file which is part of your applicaiton. Select that mbed file, click on Revision metaphor in the top bar, switch ot the newest revision.

Regards,
0xc0170

11 Feb 2014

I do get the same issue. Remembered it from before, tried it again with latest mbed-src. Both with and without beta mode enabled.

11 Feb 2014

started new thread: mbed.org/forum/platform-29-FRDM-KL46Z-community/topic/4723/

Please log in to post comments.