cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

Anonymous
Not applicable

Hi, 

   

I'm starting with development on PSOC and I'm interfacing a UART camera with CY8CKIT-059 and save the picture on a microSD, but when I try to save the picture I note that the function to write on the microSD is slow, cause not all data are writen on the SD. For example, the picture has a size of 25kb, but the file that I save has 10 kb. When I open the file on a hexadecimal editor I can see that lack many strings.

   

I add the code of the function, if is needed that I upload the project tell me.

   

---------------------------------------------

   

pFile = FS_FOpen(titulo, "w");
    Camara_PutArray(ReadPic,16);
    while(alar_idle==0){
        if(bufful==1){
            FS_FWrite(&buffrec[0],1,15,pFile);
            cont=0;
            bufful=0;
        }
    }
    FS_FWrite(&buffrec[0],1,cont,pFile);
    FS_FClose(pFile);

   

-------------------------------------------------

   

My UART buffer has a size of 15 bytes, and the baud of the camera is 38400 andhe frequency on the emFile is 4000 kHz. My alar_idle is a boolean that show me if the transmission has finished, cause when I tried check the last two bytes of the transmission the result not ever was appropriate. I've tried write with FS_Write, but it was worse.

   

I hope someone could help me.

   

---Updates--

   

-I've attached the project.
-Other problem that I had but I've solved making another routines was that I only could use the "strstr" function only once time. When start the system, but when I try to use it for take a picture, it not work.

   

-----

   

Thanks

0 Likes
Reply
4 Replies
Employee

Hello,

   

1)Can you please attach the complete project.

   

2)Did you check if the complete data is read from the camera over UART

   

3)Have you tested the same project with another SD card.

   

Thanks,

   

Hima

0 Likes
Reply
Anonymous
Not applicable

In fact, I listen the UART camera, and the transmission is OK.

   

I attach 2 files, the .jpg is the file that is saved on the microSD, and the .txt is all the strings that camera sends. I open and compare the files with a hex viewer (xvi32).

   

I've used another SD card but the problem is the same.

0 Likes
Reply
Anonymous
Not applicable

Hello Clopez,

   

How are you moving data from UART Rx buffer to buffrec? 

   

I suggest you to use DMA for this so that you will get more CPU time for writing into the SD card.

0 Likes
Reply
Anonymous
Not applicable

Sorry, is the first time that I work with a SD card, and I don't know how use the DMA, inclusively I tried to use functions as "FS_MMC_HW_X_Write" but it doesn't work. 

0 Likes
Reply