Kwikstik rev 5 + CodeWarrior: patch needed, any experience?

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

Kwikstik rev 5 + CodeWarrior: patch needed, any experience?

Jump to solution
1,755 Views
michele_novalia
Contributor III

Dear all,

 

I finally got a Kwikstikc rev 5 so that I can start use the SD card support (which was broken by design in rev 4).

I am using CodeWarrior 10.1.

 

While attempting to access to esdhc I get the following error:

 

    com_handle = fopen("esdhc:", NULL);
    if( !com_handle ) {
        printf("DBG: Opening ESDHC device failed, is ESDHC controller enabled in MQX?");        


Problem is that I have to enable ESDHC in bsp, but the
init_bsp.c
file retreives me the following error:

#error This modul unsupported with Kiwkstik Board.Please disable BSPCFG_ENABLE_ESDHC to 0 in user_config.h

 

Is there anyway around this?

Did anyone used the rev 5 of Kwikstik with codeWarrior?

 

I asked to Freescale for a patch for MQX and Kwikstik rev 5, which should prevent that re-compiling error of bsp to happen, but they said there is none available.

 

Any hint?

thanks,

Mik

 

0 Kudos
1 Solution
1,319 Views
Dekiru
Contributor IV

Kwikstik and TWR-K40 use K40 chips in different package types so you have to change bsp part where they initialize sdhc, for example _bsp_esdhc_io_init  function.

 

Apply the sources in attachment to your old MQX 3.7 kwikstik patch, you should have sdhc and rtc runable.

You can try with mfs sdcard example.

 

Regards

View solution in original post

0 Kudos
8 Replies
1,319 Views
mjbcswitzerland
Specialist V

Hi Mik

 

#error This modul unsupported with Kiwkstik Board.Please disable BSPCFG_ENABLE_ESDHC to 0 in user_config.h

 

This is a compiler error message based on an #if. is it not possible to simply delete this line so that the error goes away and then the SDHC stuff is compiled and linked and used as if it was any other board?

 

Regards

 

Mark

 

0 Kudos
1,319 Views
michele_novalia
Contributor III

Hi Mark,

 

thanks for your suggestion, however I suspect that there must be something else tied with it somehow:

even if I comment that line of code (and I get bsp and psp to compile), when I run the project in kwikstik I still get the same error on this line:

 

    com_handle = fopen("esdhc:", NULL);

 

I'm a bit lost...

Mik

0 Kudos
1,319 Views
mjbcswitzerland
Specialist V

Hi Mik

 

I don't use the solution that you are using so can't help on the details. Can you however step through the code in the fopen() so see where it returns with the invalid handle - maybe it will be obvious when you see the line of code that is aborting the open?

 

Regards

 

Mark

 

0 Kudos
1,319 Views
michele_novalia
Contributor III

Hi Mark,

 

I just tried that but I could not understand why that happens...

 

For what I can see the execution goes in here:
in io_fopen.c #93

   if (dev_ptr == (pointer)&kernel_data->IO_DEVICES.NEXT) {

       return(NULL);

 

Any clue?

Mik

0 Kudos
1,319 Views
mjbcswitzerland
Specialist V

Mik

 

This is MQX SW specific so it may be best to post in the MQX forum: http://forums.freescale.com/t5/Freescale-MQX-trade-Software/bd-p/MQXGEN

 

Regards

 

Mark

 

0 Kudos
1,319 Views
michele_novalia
Contributor III

_PARTIALLY_ solved:

(thanks to Freescale support):

 

what needs to be done to make the call:

    com_handle = fopen("esdhc:", NULL);
to succeed, is:

In the init_bsp.c file of the bsp_Kwikstikk40x256 go to the following:


#if BSPCFG_ENABLE_ESDHC
_esdhc_install ("esdhc:", &_bsp_esdhc0_init); //Enable the init process present on twr-k40x256 bsp
#endif

 

Unfortunately now it fails on:

    sdcard_handle = fopen("sdcard:", 0);

Maybe is it a similar problem?

Any hint appreciated.

 

Mik

 

0 Kudos
1,320 Views
Dekiru
Contributor IV

Kwikstik and TWR-K40 use K40 chips in different package types so you have to change bsp part where they initialize sdhc, for example _bsp_esdhc_io_init  function.

 

Apply the sources in attachment to your old MQX 3.7 kwikstik patch, you should have sdhc and rtc runable.

You can try with mfs sdcard example.

 

Regards

0 Kudos
1,319 Views
michele_novalia
Contributor III

Hi Dekiru,

 

brilliant, I'll check your patch, thanks a lot.

 

A thing I've tried last night was to recompile & link my project replacing the bsp, psp and mfs libraries with the ones coming from twr-k40x256.

It seems to work fine!

But I do wonder if there are side consequences...

 Probably your patch should serve the purpose better.

 

Thanks a lot!

Mik

 

0 Kudos