can we convert kl46z msd code for kl26z by editing that project?

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

can we convert kl46z msd code for kl26z by editing that project?

2,333 Views
arthshah
Contributor II

hello kerryzhou

i have kl46z msd code project.can i edit that project for my kl26z 256KB of chip?

is it possible?

thanks and best regards,

Arth Shah

Labels (1)
0 Kudos
Reply
14 Replies

2,097 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Arth Shah,

   Yes, you can convert the KL46Z msd code for KL26z.

  You can try it, if you meet the question, just let me know!


Have a great day,
Kerry

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

2,097 Views
arthshah
Contributor II

hello kerryzhou

i want to show my SD as a MSD using SPI protocol.

here i attach my implementation.

first i enable SD_CARD_APP function (Macro).

then i set block_no and block_size

case USB_MSC_DEVICE_GET_INFO:
device_lba_info_ptr = (device_lba_info_struct_t*) size;
#if RAM_DISK_APP
device_lba_info_ptr->total_lba_device_supports = TOTAL_LOGICAL_ADDRESS_BLOCKS_NORMAL;
device_lba_info_ptr->length_of_each_lab_of_device = LENGTH_OF_EACH_LAB;
#elif SD_CARD_APP
#if (OS_ADAPTER_ACTIVE_OS == OS_ADAPTER_SDK)
device_lba_info_ptr->total_lba_device_supports = 63;
device_lba_info_ptr->length_of_each_lab_of_device = 512;

now i change read_request and write_request and send_data complete event in usb_class_callback

case USB_MSC_DEVICE_READ_REQUEST:
lba_data_ptr = (lba_app_struct_t*) size;

#elif SD_CARD_APP

 returnCode=MMCReadSingleBlock(lba_data_ptr->offset >> SDCARD_BLOCK_SIZE_POWER,&buffer_s);
 USB_PRINTF("RC:%d",returnCode);
 g_msc_bulk_in_buff=buffer_s;
if(data != NULL)
{
*data = g_msc_bulk_in_buff;
}

lba_data_ptr->buff_ptr = g_msc_bulk_in_buff;

is it true?
i just run the project with this edition there are create disk and ask for format. when i apply  to format format is not completed.

my question is that what should i do for stop format disk and show sd data to that disk instead of RAM.

0 Kudos
Reply

2,097 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Arth,

  If you don't modified the USB MSD buffer to SD, just use the internal Flash, when you do the format, whether you can success or not?

  Please send me your KL26 MSD project to me at first.

  Now, any updated information for your SD SPI connection problem on your FRDM-KL26 board?

Have a great day,
Kerry

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

2,097 Views
arthshah
Contributor II

hello kerry,

i just getting success in RAM_DISK MSD means there are display message for format disk and getting success in formatting the disk.

and yes, now i have no problem with spi wih SD.

now my question is that how can i use SD instead of RAM for MSD and disable that format_disk command because in SD we don't need to format every time.

here i attach my project of kl26z MSD.please review it.

thanks.

0 Kudos
Reply

2,097 Views
arthshah
Contributor II

hello kerryzhou

i have use KDS IDE.so note that while using my project to on you  side.

0 Kudos
Reply

2,097 Views
kerryzhou
NXP TechSupport
NXP TechSupport

HI Arth Shah,

   Do you test it on the KL26 KSDK?

  I build your project on my side, it has errors:

pastedImage_1.png

Kerry

0 Kudos
Reply

2,097 Views
arthshah
Contributor II

hello kerry,

i think these errors is because of compiler not getting correct path of files please give KSDK path and then try it again.

thanks

0 Kudos
Reply

2,097 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Please tell me the msd project path in the SDK_2.3.0_FRDM-KL46Z, maybe you also can send me your modified SDK, you can delete all the other project which is not used.

Kerry

0 Kudos
Reply

2,097 Views
arthshah
Contributor II

hello kerryzhou,

do you have any idea about what changes are require for SD show as MSD instead of RAM.

?

0 Kudos
Reply

2,097 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Arth Shah,    

I check the SDK1.3.0 msd code for KL46:C:\Freescale\KSDK_1.3.0\examples\frdmkl46z\demo_apps\usb\device\msd

, I found the official msd code already add the sd card structure. Please search SD_CARD_APP,

pastedImage_1.png
  In dish.h, please modify these code:
#define RAM_DISK_APP                        (0)//1
#define SD_CARD_APP                         (1)
Then the MSD buffer won't use the RAM, it will use the SD card, then you add your MSD code to the according place.
  Please try it by yourself.

Wish it helps you!

Have a great day,
Kerry

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------


0 Kudos
Reply

2,097 Views
arthshah
Contributor II

ya..i test on my kl26z board.here tis no error like that.

actually this project is for kl46z and i used for kl26z by editing some library and linker file.

currently i have no error in this project.

0 Kudos
Reply

2,097 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Thank you for your updated information.

 I will check it on my side, and give you updated information later.

Best Regards,

Kerry

0 Kudos
Reply

2,097 Views
arthshah
Contributor II

okey kerry,

i will wait for your response.

thanks for your upport..!!

0 Kudos
Reply

2,097 Views
arthshah
Contributor II

hello kerryzhou

thanks for the reply.

i have converted my kl46z for kl26z successfully.

now i want to show my SD as MSD how can i achieve this using SPI interfacing.

i already implemented SD with SPI using below link provided by you.

Porting FatFs file system to KL26 SPI SD card code 

but how can i use this protocol into MSD project for show my SD as a MSD?

please give me some idea.

Thanks and Best Regards,

Arth Shah.

0 Kudos
Reply