We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi, I am using RTX kernel to read write to MMC the program works fine with normal operation ,but when I use the same code with RTX kernel it does not creat any file infact no information from the MMC is get like File system etc ,is there any new method to use MMC card with MMC any specific routenes for file creation
#include "91x_lib.h" #include<stdlib.h> #include <string.h> #include <stdio.h> #include "mmc.h" #include "fat.h" #ifndef FALSE #define FALSE 0 #define TRUE 1 #endif int main(void) { unsigned char SPI_Buffer[512]; unsigned char data[50]="hello world941\n"; unsigned int x = 0, y = 0; char fname[20]; unsigned char MMCPRESENCE = 0; unsigned char z = FALSE; // char *header = (char *)malloc(14); // char *infoheader = (char *)malloc(40); File_Handler *file_handle; file_handle = (File_Handler*)calloc(1,sizeof(File_Handler)); SCU_Configuration(); UART_0_GPIO_5_INIT(); UART0_INIT(); //SCU_Configuration(); //Enabling peripheral clock for SSP0 and GPIO2(SSP0 in port 2) GPIO_Configuration(); // configuring SSP0 pins in port2 init_SSP0(); // createheader(header,116,104); /// createinfoheader(infoheader,116,104); MMCPRESENCE = init_MMC(); printf("MMCPRESENCE %x \n\r",MMCPRESENCE); printf("Logging data to MMC\n\r"); Read_Disk_Info(SPI_Buffer,file_handle); Display_Disk_Info(file_handle); // Display_Disk_Info(file_handle); printf("opening file\n\r"); sprintf(fname,"DATA.TXT"); z=File_Open(fname,SPI_Buffer,file_handle); printf("z: %x \n\r",z); //while(1) //{ if(z==TRUE) { printf("writing \n\r"); Write_File(file_handle,data,strlen(data),SPI_Buffer); printf("written\n\r"); } //} File_close(file_handle); printf("file closed \n\r"); }
above code works fine without RTX but no file created in RTX kernel
thankd
presently I am using a single task in which no other task is called even then MMC is not responding I call every function in main
#include <RTL.h> #include <91x_lib.H> #include "LCD.h" #include "RT_Agent.h" /* Real-Time Agent definitions */ #include <stdio.h> #include "mmc.h" #include "fat.h" /* id1, id2, id3, id4 will contain task identifications at run-time */ OS_TID id1, id2, id3, id4,id5; OS_MUT mutex1; /*---------------------------------------------------------------------------- * Main: Initialize and start RTX Kernel *---------------------------------------------------------------------------*/ int main (void) { //os_sys_init (task1); unsigned char SPI_Buffer[512]; unsigned char data[50]="hello world941\n"; unsigned int x = 0, y = 0; char fname[20]; unsigned char MMCPRESENCE = 0; unsigned char z = FALSE; // char *header = (char *)malloc(14); // char *infoheader = (char *)malloc(40); File_Handler *file_handle; file_handle = (File_Handler*)calloc(1,sizeof(File_Handler)); SCU_Configuration(); UART_0_GPIO_5_INIT(); UART0_INIT(); printf("hi"); // UART_0_GPIO_5_INIT(); // UART0_INIT(); //SCU_Configuration(); //Enabling peripheral clock for SSP0 and GPIO2(SSP0 in port 2) os_mut_init (mutex1); GPIO_Configuration(); // configuring SSP0 pins in port2 init_SSP0(); // createheader(header,116,104); /// createinfoheader(infoheader,116,104); MMCPRESENCE = init_MMC(); printf("MMCPRESENCE %x \n\r",MMCPRESENCE); // printf("Logging data to MMC\n\r"); Read_Disk_Info(SPI_Buffer,file_handle); Display_Disk_Info(file_handle); Display_Disk_Info(file_handle); printf("opening file\n\r"); sprintf(fname,"DATA.TXT"); z=File_Open(fname,SPI_Buffer,file_handle); printf("z: %x \n\r",z); //while(1) //{ if(z==TRUE) { printf("writing \n\r"); Write_File(file_handle,data,strlen(data),SPI_Buffer); printf("written\n\r"); } //} File_close(file_handle); printf("file closed \n\r"); os_mut_release (mutex1); } /*---------------------------------------------------------------------------- * end of file *---------------------------------------------------------------------------*/
even then its not working
Is not any of the functions returning any results back to help you figuring out the problem?
Not even test code should ignore looking at result codes/sizes.