(mp3 or wav file) --> sd_card --> nrf51822 --> smart phone
Read the data from the SD_CARD transfers to smartphone.
void BLE_SEND_VOICE(void) {
f_mount(0,&fs);
f_open(&fsrc, "0:/voice.mp3", FA_OPEN_EXISTING | FA_READ );
while(1)
{
if( fsrc.fptr == fsrc.fsize )
{
f_lseek(&fsrc,0);
Record_Start = 0;
break;
}
res = f_read(&fsrc, buffer, sizeof(buffer), &br );
for( br = 0; br < 32; br++ )
{
ble_nus_send_string(&m_nus, buffer,16);
}
}
f_close(&fsrc);
}
I know that with a maximum length of 20byte.
So I was sent by 16 byte. (512/32 = 16)
As a result,
When using the VS1003B module, As follows:
void Record_File_Open(const TCHAR * path) {
f_mount(0,&fs);
f_open(&fsrc, path, FA_OPEN_EXISTING | FA_READ );
while(Record_Start)
{
if( fsrc.fptr == fsrc.fsize )
{
f_lseek(&fsrc,0);
Record_Start = 0;
break;
}
res = f_read(&fsrc, buffer, sizeof(buffer), &br );
for( br = 0; br < 16; br++ )
{
while( VS1003B_DREQ_READ() !=0 );
VS1003_WriteData( buffer + br * 32 );
}
}
f_close(&fsrc);
}
I think the problem because Checksum.
When using the VS1003b module, and checks a signal transmitted from VS1003b.
However, i don't know what to do checks on smartphone.
What do you think?
This source is correct I don't know what you want. hassan789
I hope this helps. Please refer to the source.
FATFS fs; // Work area (file system object) for logical drive
FIL fsrc; // file objects
FRESULT res;
UINT br;
uint8_t * read_sd_card_text_file(const TCHAR *path)
{
char Font_Buf[2048];
f_mount(0,&fs);
f_open(&fsrc, path, FA_OPEN_EXISTING | FA_READ );
while(1)
{
if( fsrc.fptr == fsrc.fsize )
{
f_lseek(&fsrc,0); break;
}
res = f_read(&fsrc, Font_Buf, sizeof(Font_Buf)-1, &br );
}
f_close(&fsrc);
}
void Record_File_Write(const TCHAR *path) { f_mount(0,&fs);
res = f_open( &fsrc , path, FA_CREATE_ALWAYS | FA_WRITE);
f_write( &fsrc, buffer, sizeof(buffer) , &br );
f_close(&fsrc);
}