This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Sending file through UART by using nrf51422 with Keil SW

Hi,


I am using Nrf51422 DK, my need is to send file (which is placed in my computer)to the another nrf board. Tried with file operations (fopen,fgetc,etc.) in keil4. It doesn't showing errors & warnings. file pointer showing null after flashing into the board by using NRFGoStudio. Is it is correct way of doing? please correct me if i am going wrong.

thanks in advance.

this is the way i am handling file,

while (true)
{
uint8_t cr;
FILE *f;
f = fopen ("C:\\Users\\Hardik\\Desktop\\testi.hex","r");
if (f == NULL) {
printf ("File not found!\n");
}
//while(app_uart_get(&cr) != NRF_SUCCESS);
do
{
// Taking input single character at a time
cr = fgetc(f);

// Checking for end of file
if (feof(f))
break ;

while(app_uart_put(cr) != NRF_SUCCESS);
printf("%c", cr);
} while(1);

Related