Not applicable
Apr 04, 2013
05:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 04, 2013
05:40 AM
Hello,
I would like to build a program to write in a SSD card file every second. The main program is an expansion of the WEBSERVER001_Example2.
First I have used the functions of SYSTM001 app to create a timer to call a function every second and to start it. I have done this without any trouble with the next code.
The problem is when I call the file_test (Create file and write) function of SLTHA001_Example1 to create and write on a SSD card. At the moment that I call this function, the interrupt stops working. The code is the next.
Could anyone tell me if this is the best way to do it? Why the interrupt stops working? There is another method to perform an interrupt?
Regards and thanks in advance,
MagicPhoton
I would like to build a program to write in a SSD card file every second. The main program is an expansion of the WEBSERVER001_Example2.
First I have used the functions of SYSTM001 app to create a timer to call a function every second and to start it. I have done this without any trouble with the next code.
handle_t TimerId;
/*Call update_value() every 1s*/
TimerId = SYSTM001_CreateTimer(1000, SYSTM001_PERIODIC, update_value, NULL);
while(1);
}
SYSTM001_StartTimer(TimerId);
}
The problem is when I call the file_test (Create file and write) function of SLTHA001_Example1 to create and write on a SSD card. At the moment that I call this function, the interrupt stops working. The code is the next.
/* Create file and write */
int file_test(void)
{
FILE *ptr;
status_t status;
const char *filename = "eu.ssi";
uint32_t block_size;
uint32_t num_blocks;
ptr = fopen(filename, "w+");
fseek(ptr, 0, SEEK_SET);
if (ptr == NULL)
return -1;
block_size = sizeof(buffer);
num_blocks = sizeof(char);
fwrite(&buffer, num_blocks, block_size, ptr);
fflush(ptr);
status = fclose(ptr);
CHECK_STATUS(status, -1);
return 1;
}
Could anyone tell me if this is the best way to do it? Why the interrupt stops working? There is another method to perform an interrupt?
Regards and thanks in advance,
MagicPhoton
3 Replies
Apr 16, 2013
04:53 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 16, 2013
04:53 AM
Can you explain this:
How many times per second you start the timer?
while(1);
}
SYSTM001_StartTimer(TimerId);
}
How many times per second you start the timer?
Apr 18, 2013
11:06 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 18, 2013
11:06 PM
Hi, Please allow me to look into this issue. 😄
Not applicable
Apr 23, 2013
02:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 23, 2013
02:25 AM
Hello,
Thanks for try to help me. Sorry for my wrong code example, I tried to adapt this code to show my problem but I put the timer timer start in a while(1) loop.
I have solved the problem. The thing was that I used the functions to write in the SD card inside the interrupt vector and this functions were producing another interrupt and the program got hanged.
Best regards,
MagicPhoton
Thanks for try to help me. Sorry for my wrong code example, I tried to adapt this code to show my problem but I put the timer timer start in a while(1) loop.
I have solved the problem. The thing was that I used the functions to write in the SD card inside the interrupt vector and this functions were producing another interrupt and the program got hanged.
Best regards,
MagicPhoton