Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ub6470 #1

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
05f4703
drivers/ub6470 : add ub6470 driver support + rtk i2s patch
abhishek-samsung Mar 3, 2022
7723684
write read patch
abhishek-samsung Mar 10, 2022
b7c52af
i2c probe patch
abhishek-samsung Mar 10, 2022
5d5602f
i2c test patch
abhishek-samsung Mar 16, 2022
2d164c9
set i2s config, 48k 32b 2channels
abhishek-samsung Mar 31, 2022
9adf65d
audio test patch
abhishek-samsung Apr 12, 2022
bfc77ee
remove i2c debug logs and decrease wait timings
abhishek-samsung Apr 13, 2022
01d7239
add 96Khz and 16bit support
abhishek-samsung Apr 13, 2022
4af3705
Revert "add 96Khz and 16bit support"
abhishek-samsung Apr 13, 2022
56e92eb
32bit 48k test
abhishek-samsung Apr 18, 2022
7150f79
temp commit for 16 to 32bit conversion
abhishek-samsung Apr 19, 2022
5c699e7
Revert "temp commit for 16 to 32bit conversion"
abhishek-samsung May 10, 2022
ee61f40
96k 16bit
abhishek-samsung May 11, 2022
9c445f2
48k 32bit with 16bit audio
abhishek-samsung May 11, 2022
24ed815
96khz and 16bit with debug registers print
abhishek-samsung May 16, 2022
e604fec
lldbg -> printf
abhishek-samsung May 16, 2022
dc52100
mediaplayer changes to only show start and stop
abhishek-samsung May 17, 2022
bbda9cd
set to 96k and print 0x0F
abhishek-samsung May 17, 2022
d634c80
48k 32bit on board
abhishek-samsung May 23, 2022
a5a5481
New flash size support and 96k 16bit
abhishek-samsung Jun 28, 2022
38b38fe
Change back to 48K and 32bit
abhishek-samsung Jul 6, 2022
7d770ef
split init code
abhishek-samsung Jul 12, 2022
9f6846c
16 bit padding patch rtk
abhishek-samsung Jul 12, 2022
f103f1e
final patch from rtk
abhishek-samsung Jul 26, 2022
387b607
disable all debug logs and apply rtk patch -- playback working fine
abhishek-samsung Aug 10, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
240 changes: 240 additions & 0 deletions apps/examples/hello/hello_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,257 @@

#include <tinyara/config.h>
#include <stdio.h>
#include <debug.h>


#include <stdlib.h>
#include <tinyara/i2c.h>

/****************************************************************************
* hello_main
****************************************************************************/
#define byteWrite_DEBUG
#define UART_Printf printf


#define DEVICE_ADDRESS 0x1A // Device address when ADO = 1

#define I2C_FREQ 100000

int counter = 0;

extern int amebad_PA0_set(unsigned int value);

#ifdef CONFIG_BUILD_KERNEL
int main(int argc, FAR char *argv[])
#else
int hello_main(int argc, char *argv[])
#endif
{
#if 1
amebad_PA0_set(0);
lldbg("set gpio0 to low");
lldbg("registering i2s driver\n");
struct i2s_dev_s *i2s = amebad_i2s_initialize(0);
sleep(2);
amebad_PA0_set(1);
lldbg("set gpio0 to high");
sleep(2);
FAR struct i2c_dev_s *dev;

dev = up_i2cinitialize(0);

int ret = 0;
FAR struct i2c_config_s config;
uint8_t buf[2];
uint8_t addr[2];

config.frequency = 100000;
config.addrlen = 7;
config.address = 0x1A;

// while(true) {

addr[0] = 0x04;
addr[1] = 0x00;

ret = i2c_write(dev, &config, addr, 2);

if (ret != 2) {
lldbg("write fail\n");
return;
}
else lldbg("written 0x%02x to regaddr 0x%02x\n", addr[1], addr[0]);

sleep(2);

ret = i2c_write(dev, &config, addr, 1); // send address 0x01 followed by read command.

if (ret != 1) {
lldbg("write fail\n");
return;
}

ret = i2c_read(dev, &config, buf, 1);

if (ret != 1) {
lldbg("read fail\n");
return;
}

lldbg("read 0x%02x from regaddr 0x%02x\n", buf[0], addr[0]);

sleep(2);

addr[0] = 0x05;
addr[1] = 0x3F;

ret = i2c_write(dev, &config, addr, 2);

if (ret != 2) {
lldbg("write fail\n");
return;
}
else lldbg("written 0x%02x to regaddr 0x%02x\n", addr[1], addr[0]);

sleep(2);

ret = i2c_write(dev, &config, addr, 1); // send address 0x01 followed by read command.

if (ret != 1) {
lldbg("write fail\n");
return;
}

ret = i2c_read(dev, &config, buf, 1);

if (ret != 1) {
lldbg("read fail\n");
return;
}

lldbg("read 0x%02x from regaddr 0x%02x\n", buf[0], addr[0]);

sleep(2);

addr[0] = 0x03; // write to regaddr 0x01 value 0x00
addr[1] = 0x01;

ret = i2c_write(dev, &config, addr, 2);

if (ret != 2) {
lldbg("write fail\n");
return;
}
else lldbg("written 0x%02x to regaddr 0x%02x\n", addr[1], addr[0]);

sleep(2);

ret = i2c_write(dev, &config, addr, 1); // send address 0x01 followed by read command.

if (ret != 1) {
lldbg("write fail\n");
return;
}

ret = i2c_read(dev, &config, buf, 1);

if (ret != 1) {
lldbg("read fail\n");
return;
}


lldbg("read 0x%02x from regaddr 0x%02x\n", buf[0], addr[0]);

sleep(2);

addr[0] = 0x01;
addr[1] = 0x00;

ret = i2c_write(dev, &config, addr, 2);

if (ret != 2) {
lldbg("write fail\n");
return;
} else lldbg("written 0x%02x to regaddr 0x%02x\n", addr[1], addr[0]);

sleep(2);

while(true) {

ret = i2c_write(dev, &config, addr, 1); // send address 0x01 followed by read command.

if (ret != 1) {
lldbg("write fail\n");
return;
}

ret = i2c_read(dev, &config, buf, 1);

if (ret != 1) {
lldbg("read fail\n");
return;
}

lldbg("read 0x%02x from regaddr 0x%02x\n", buf[0], addr[0]);

if (buf[0] == 0x02) break; // wait until we read 0x02 from the register.

sleep(2);

}

addr[0] = 0x2A; // write to regaddr 0x01 value 0x00
addr[1] = 0xCC;

ret = i2c_write(dev, &config, addr, 2);

if (ret != 2) {
lldbg("write fail\n");
return;
}
else lldbg("written 0x%02x to regaddr 0x%02x\n", addr[1], addr[0]);

sleep(2);

ret = i2c_write(dev, &config, addr, 1); // send address 0x01 followed by read command.

if (ret != 1) {
lldbg("write fail\n");
return;
}

ret = i2c_read(dev, &config, buf, 1);

if (ret != 1) {
lldbg("read fail\n");
return;
}


lldbg("read 0x%02x from regaddr 0x%02x\n", buf[0], addr[0]);

sleep(2);

addr[0] = 0x2B; // master volume fine
addr[1] = 0x03;

ret = i2c_write(dev, &config, addr, 2);

if (ret != 2) {
lldbg("write fail\n");
return;
}
else lldbg("written 0x%02x to regaddr 0x%02x\n", addr[1], addr[0]);

sleep(2);

ret = i2c_write(dev, &config, addr, 1); // send address 0x01 followed by read command.

if (ret != 1) {
lldbg("write fail\n");
return;
}

ret = i2c_read(dev, &config, buf, 1);

if (ret != 1) {
lldbg("read fail\n");
return;
}


lldbg("read 0x%02x from regaddr 0x%02x\n", buf[0], addr[0]);

#else
sleep(2);
counter++;
printf("Hello, World!!\n");
if (counter == 3) {
printf("registering i2s driver\n");
struct i2s_dev_s *i2s = amebad_i2s_initialize(0);
}
#endif
return 0;
}
2 changes: 1 addition & 1 deletion apps/examples/mediaplayer/BufferInputDataSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ bool BufferInputDataSource::isPrepared()
bool BufferInputDataSource::open()
{
if (!isPrepared()) {
mFp = fopen("/rom/over_16000.mp3", "rb");
mFp = fopen("/mnt/sample.mp3", "rb");
mSrcSize = 2048;
mSrcBuf = new unsigned char[mSrcSize];
// Application can specify all audio informations (audioType/sampleRate/channels/pcmFormat),
Expand Down
18 changes: 9 additions & 9 deletions apps/examples/mediaplayer/CmdView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ int CmdView::selectSource(vector<string> sourceList)
}
cout << "====================" << endl;

return getUserInput(0, sourceList.size());
return 4;//getUserInput(0, sourceList.size());
}

int CmdView::selectPlayer(void)
Expand All @@ -70,7 +70,7 @@ int CmdView::selectPlayer(void)
cout << " 2. Select PLAYER B " << endl;
cout << "====================" << endl;

int player = getUserInput(0, 2) - 1;
int player = 1 -1 ; //getUserInput(0, 2) - 1;
if (player != -1) {
cout << "PLAYER " << (char)('A' + player) << " is selected" << endl;
}
Expand All @@ -82,13 +82,13 @@ int CmdView::selectCommand(void)
cout << "====================" << endl;
cout << " 0. Do Nothing " << endl;
cout << " 1. PLAYER_START " << endl;
cout << " 2. PLAYER_PAUSE " << endl;
cout << " 3. PLAYER_RESUME " << endl;
cout << " 4. PLAYER_STOP " << endl;
cout << " 5. GET_MAX_VOLUME " << endl;
cout << " 6. VOLUME_UP " << endl;
cout << " 7. VOLUME_DOWN " << endl;
// cout << " 2. PLAYER_PAUSE " << endl;
// cout << " 3. PLAYER_RESUME " << endl;
cout << " 2. PLAYER_STOP " << endl;
// cout << " 5. GET_MAX_VOLUME " << endl;
// cout << " 6. VOLUME_UP " << endl;
// cout << " 7. VOLUME_DOWN " << endl;
cout << "====================" << endl;
return getUserInput(0, 7);
return getUserInput(0, 2);
}
}
Loading