Dear Sirs!
In my project I want to get the audio stream at the line input of the SGTL5000, compress and call the socket to transfer the data over the ethernet network.
Audio can be received on a network computer or other hardware with the Freedom K64.
I'm using Freedom K64, the KDS and SDK tools.
I see the example codes for Iwip and SAI worked, but I do not know how to modify them for my application.
How can you help me? Can you compile an example code?
Hi, Cristiano,
I suggest you develop the code in SDK platform and FreeRtos os. After the I2S received the predefined size of data, a callback function is called, you can set a flag in the I2S callback function.
In the LWIP thread, you can set the ip address and port in the buff and use the netconn_send(conn, buf); function to send the data if the flag in the callback function is set.
I do not know how to compress the audio data.
Hope it can help you
BR
XiangJun Rong
static void udpecho_thread(void *arg)
{
static struct netconn *conn;
static struct netbuf *buf;
char buffer[100];
err_t err;
LWIP_UNUSED_ARG(arg);
netif_set_up(&fsl_netif0);
conn = netconn_new(NETCONN_UDP);
LWIP_ASSERT("con != NULL", conn != NULL);
netconn_bind(conn, NULL, 7);
while (1)
{
// err = netconn_recv(conn, &buf);
if (err == ERR_OK)
{
if (netbuf_copy(buf, buffer, buf->p->tot_len) != buf->p->tot_len)
{
LWIP_DEBUGF(UDPECHO_DBG, ("netbuf_copy failed\r\n"));
}
else
{
buffer[buf->p->tot_len] = '\0';
err = netconn_send(conn, buf);
if (err != ERR_OK)
{
LWIP_DEBUGF(UDPECHO_DBG, ("netconn_send failed: %d\r\n", (int)err));
}
else
{
LWIP_DEBUGF(UDPECHO_DBG, ("got %s\r\n", buffer));
}
}
netbuf_delete(buf);
}
}
}
Hi Cristiano,
In KDS, you can use New Project Wizard (File - New - Kinetis SDK 2.x Project), select SDK path and then select example. This will clone all example souce files into your workspace. Then you can easily modify the project
Please ensure, you have latest version of New Project Wizard (from update site) and SDK package.
Regards
Marek