Skip to content

Commit

Permalink
Merge pull request #13 from Avnet/updatePublicFromPrivate
Browse files Browse the repository at this point in the history
v1.6.1 changes
  • Loading branch information
bawilless authored Jun 25, 2024
2 parents ac2fcb7 + 481a666 commit 80ca704
Show file tree
Hide file tree
Showing 11 changed files with 118 additions and 79 deletions.
12 changes: 9 additions & 3 deletions docs/ApplicationUserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ The NDP120 is configured by identifying the firmware images that will be loaded

- [Video Link (3 minutes)](http://avnet.me/RASynChangingMlModelsVideo)

There are two areas in the config.ini file to configure which NDP120 files are loaded to the NDP120 at startup.
There are two areas in the config.ini file to configure which NDP120 files/model(s) are loaded to the NDP120 at startup.

1. ```[NDP Firmware]-->Mode=x```

Expand All @@ -101,6 +101,11 @@ Each ```[Function_x]``` block defines a description, and the three required NDP1
- ```MCU``` refers to the ARM-M0 firmware that runs on the NDP120. This firmware manages the devices and data flow.
- ```DSP``` refers to the dsp firmware that runs on the NDP120. This firmware does data pre-processing plus other functions.
- ```DNN``` refers to the Nerual Network Parameters and ML model. This firmware implements the ML model.
- ```Event_Watch_Mode``` tells the NDP120 what data streams to watch and needs to align with the model defined in the ```DNN``` entry.
- 1 == Audio
- 2 == IMU
- 3 == Combined Audio & IMU data


![](./assets/images/ndpConfig.jpg "")

Expand Down Expand Up @@ -131,9 +136,10 @@ There are two different ways to redefine the decimation_inshift vaules at startu

![](./assets/images/decimationInshift02.jpg "")


## LED control
The ```[LED]``` block allows the user to assign different RGB LED colors to each inference index. When the NDP120 detects a feature in the data the inference results are passed to the application. The application uses the index of the inference result [0 - n] to identify how to light the RGB LED on the I/O board. The comments in the config.ini file associate each index with the 5-keyword model, but this feature works with any model that's loaded.
The ```[Led Network x]``` blocks allow the user to assign different RGB LED colors to each neural network and inference index. When the NDP120 detects a feature in the data the network number and inference results are passed to the application. The application uses the
neural network number and the index of the inference result [0 - n] to identify how to light the RGB LED on the I/O board. The comments
in the config.ini file associate each index with the 5-keyword model, but this feature works with any model that's loaded.

- [Video Link (3 minutes)](http://avnet.me/RASynChangeLedColorsVideo)

Expand Down
Binary file modified docs/assets/images/ledConfig.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/images/ndpConfig.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
40 changes: 38 additions & 2 deletions ndp120/synpkg_files/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Description="5-keywords Single Mic"
MCU=mcu_fw_120.synpkg
DSP=dsp_firmware.synpkg
DNN=menu_demo_512_general_v110_rasyn_pdm0_ext_icm.synpkg
Event_Watch_Mode=1 # 1==Audio, 2==IMU, 3==Audio&IMU
#DECIMATION_INSHIFT_VALUE=10 # http://avnet.me/RASynDocsDecimationInshift

# Reduce the 5-keyword model input audio gain by 6db for better performance
Expand All @@ -23,54 +24,89 @@ Description="5-keywords Dual Mic"
MCU=mcu_fw_120.synpkg
DSP=dsp_firmware_noaec_ff.synpkg
DNN=menu_demo_512_noaec_ff_v110_rasyn_pdm0_ext_icm.synpkg
Event_Watch_Mode=1 # 1==Audio, 2==IMU, 3==Audio&IMU

[Function_3]
Description="Circle Motion"
MCU=mcu_fw_120.synpkg
DSP=dsp_firmware.synpkg
DNN=circular_motion_NDP120B0_icm42670_pcm_ext.synpkg
Button_shift=imu # redefine the short press user button to capture the IMU data
Event_Watch_Mode=2 # 1==Audio, 2==IMU, 3==Audio&IMU

[Function_4]
Description="Edge Impulse Audio Model Configuration"
MCU=mcu_fw_120.synpkg
DSP=dsp_firmware.synpkg
DNN=ei_model.synpkg
Event_Watch_Mode=1 # 1==Audio, 2==IMU, 3==Audio&IMU

[Function_5]
Description="Edge Impulse Motion Model Configuration"
MCU=mcu_fw_120.synpkg
DSP=dsp_firmware.synpkg
DNN=ei_motion_model.synpkg
Button_shift=imu
Event_Watch_Mode=2 # 1==Audio, 2==IMU, 3==Audio&IMU

[Function_6]
Description="Alexa Single Mic"
MCU=mcu_fw_120.synpkg
DSP=dsp_firmware.synpkg
DNN=alexa_334_NDP120_B0_v11.synpkg
Event_Watch_Mode=1 # 1==Audio, 2==IMU, 3==Audio&IMU

[Function_7]
Description="Alexa Dual Mic"
MCU=mcu_fw_120.synpkg
DSP=dsp_firmware_noaec_ff.synpkg
DNN=alexa_334ua__v2_ndp120b0_noaec_ff.synpkg
Event_Watch_Mode=1 # 1==Audio, 2==IMU, 3==Audio&IMU

[Function_8]
Description="5-keywords Single Mic and Circular Motion Fusion"
MCU=mcu_fw_120.synpkg
DSP=dsp_firmware.synpkg
DNN=combined_imu_kws_ndp120_v3.synpkg
Event_Watch_Mode=3 # 1==Audio, 2==IMU, 3==Audio&IMU
# Reduce the 5-keyword model input audio gain by 6db for better performance
DECIMATION_INSHIFT_OFFSET=-1

[Function_9]
Description="Alexa Single Mic and Circular Motion Fusion"
MCU=mcu_fw_120.synpkg
DSP=dsp_firmware.synpkg
DNN=alexa334_circular_v2-2024-06-24.synpkg
Event_Watch_Mode=3 # 1==Audio, 2==IMU, 3==Audio&IMU

[Function_10]
Description="RASynPuck Demo"
MCU=mcu_fw_120.synpkg
DSP=dsp_firmware.synpkg
DNN=RASynPuckDemoV1.synpkg
Button_shift=imu # redefine the short press user button to capture the IMU data
Event_Watch_Mode=2 # 1==Audio, 2==IMU, 3==Audio&IMU

# http://avnet.me/RASynDocsLeds
[Led]
# Define which color LED the application will light for network 0 inference events
[Led Network 0]
# set led response color for each voice command, choose from # "red","green","blue","yellow","cyan" and "magenta".
IDX0=yellow # ok-syntiant
IDX0=blue # ok-syntiant
IDX1=cyan # up
IDX2=magenta # down
IDX3=red # back
IDX4=green # next

# http://avnet.me/RASynDocsLeds
# Define which color LED the application will light for network 1 inference events
[Led Network 1]
# set led response color for each voice command, choose from # "red","green","blue","yellow","cyan" and "magenta".
IDX0=green
IDX1=red
IDX2=blue
IDX3=cyan
IDX4=yellow

# http://avnet.me/RASynDocsDebugPort
[Debug Print]
# Select debug port for application debug:
Expand Down
21 changes: 21 additions & 0 deletions releaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
## Version: 1.6.1
Release type: **Feature Release**

Date: June 25, 2024

## Note: The V1.6.1 release is compatible with Edge Impulse Models generated after June 10th 2024

### New Features
- AAGBT-166: Add config.ini support to identify how the NDP120 pulls in data for each model (audio, IMU, or audio & IMU)
- AAGBT-168: Add config.ini support to identify which LED color lights by neural network number and inference index

### Bug Fixes
None

### Known Issues
- AAGBT-165: When capturing IMU data converted from ADC values to accelerometer and gyro units to debug sometimes the application hangs. This appears to be a floating point printf() issue and is currently masked by reducing the floating point precision to 3 places. For full precision data, please capture converted IMU data to the microSD card file system.
- AAGBT-159: The EVK does not power up with powered by just a battery. See [troubleshooting guide](https://github.com/Avnet/RASynBoard-Out-of-Box-Demo/blob/rasynboard_v2_tiny/docs/RASynTroubleshootingGuide.md#the-rasynboard-evk-io-board--core-board-does-not-power-up-when-using-just-a-lipo-battery) for a work around
- AAGBT-159: When powering EVK from a battery the RGB LEDs are not powered. See [troubleshooting guide](https://github.com/Avnet/RASynBoard-Out-of-Box-Demo/blob/rasynboard_v2_tiny/docs/RASynTroubleshootingGuide.md#the-rasynboard-evk-io-board--core-board-does-not-power-up-when-using-just-a-lipo-battery) for a hardware work around
- AAGBT-105: When using a custom BLE name, the OOB application is not able to connect to the Python GUI demo application
- AAGBT-123: When capturing audio, or IMU data if there is an issue receiving data from the NDP120 the application hangs

## Version: 1.6.0
Release type: **Feature Release**

Expand Down
102 changes: 38 additions & 64 deletions src/fat_load.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ struct config_ini_items config_items ={ /* default settings */
LED_EVENT_NONE },

.recording_period = 10,
.event_watch_mode = 1,
.imu_conversion_enabled = 1,
.imu_write_to_file = IMU_FUNC_ENABLE,
.imu_print_to_terminal = IMU_FUNC_DISABLE,
Expand Down Expand Up @@ -67,7 +68,6 @@ static uint32_t fatfs_total_sectors;
static int boot_mode = BOOT_MODE_NONE;
static int sdcard_slot_status = SDCARD_IN_SLOT;
static int print_console_type = CONSOLE_UART;
static uint32_t event_watch_mode = WATCH_TYPE_AUDIO; //default

char mode_description[64] = {0};
int mode;
Expand Down Expand Up @@ -504,37 +504,14 @@ void write_extraction_file_end(void)
}
}

static void parse_event_watch_mode( void )
{
switch (mode)
{
case 3:
case 5:
event_watch_mode = WATCH_TYPE_MOTION;
break;

case 8:
event_watch_mode = WATCH_TYPE_AUDIO | WATCH_TYPE_MOTION;
break;

case 1:
case 2:
case 4:
case 6:
case 7:
default:
event_watch_mode = WATCH_TYPE_AUDIO;
break;
}
}

static uint32_t read_config_file( void )
{
FRESULT res;
FILINFO fno;
char inifile[] = "0:/config.ini";
char color[16] = {0};
char key[6] = {0};
char net[16] = {0};
char section[24] = {0};

// mount
Expand All @@ -557,7 +534,6 @@ static uint32_t read_config_file( void )
/* Read config.ini from sdcard */
mode = ini_getl("NDP Firmware", "Mode", 0, inifile);
sprintf(section, "Function_%d", mode);
parse_event_watch_mode();

ini_gets(section, "Description", NULL, config_items.mode_description, sizeof(config_items.mode_description), inifile);

Expand All @@ -571,37 +547,40 @@ static uint32_t read_config_file( void )
config_items.button_switch, sizeof(config_items.button_switch), inifile);
config_items.dec_inshift_value = ini_getl(section, "DECIMATION_INSHIFT_VALUE", DEC_INSHIFT_VALUE_DEFAULT, inifile);
config_items.dec_inshift_offset = ini_getl(section, "DECIMATION_INSHIFT_OFFSET", DEC_INSHIFT_OFFSET_DEFAULT, inifile);

/* Get led color according according to voice command */
for (int idx = 0; idx < LED_EVENT_NUM; idx++)
{
sprintf(key, "IDX%d", idx);
ini_gets("Led", key, "-", color, sizeof(color), inifile);

if( strncmp(color, "red", 3) == 0)
{
config_items.led_event_color[idx] = LED_COLOR_RED;
} else if( strncmp(color, "green", 5) == 0)
{
config_items.led_event_color[idx] = LED_COLOR_GREEN;
} else if( strncmp(color, "blue", 4) == 0)
{
config_items.led_event_color[idx] = LED_COLOR_BLUE;
} else if( strncmp(color, "cyan", 4) == 0)
{
config_items.led_event_color[idx] = LED_COLOR_CYAN;
} else if( strncmp(color, "magenta", 6) == 0)
{
config_items.led_event_color[idx] = LED_COLOR_MAGENTA;
} else if( strncmp(color, "yellow", 6) == 0)
{
config_items.led_event_color[idx] = LED_COLOR_YELLOW;
} else
{
config_items.led_event_color[idx] = LED_EVENT_NONE;
}
config_items.event_watch_mode = ini_getl(section, "Event_Watch_Mode", WATCH_TYPE_AUDIO, inifile);

/* Get led color according to network number and inference index */
for (int network = 0; network < LED_NETWORK_NUM; network++){
for (int idx = 0; idx < LED_EVENT_NUM; idx++)
{
sprintf(net, "LED Network %d", network);
sprintf(key, "IDX%d", idx);
ini_gets(net, key, "-", color, sizeof(color), inifile);

if( strncmp(color, "red", 3) == 0)
{
config_items.led_event_color_data[network][idx] = LED_COLOR_RED;
} else if( strncmp(color, "green", 5) == 0)
{
config_items.led_event_color_data[network][idx] = LED_COLOR_GREEN;
} else if( strncmp(color, "blue", 4) == 0)
{
config_items.led_event_color_data[network][idx] = LED_COLOR_BLUE;
} else if( strncmp(color, "cyan", 4) == 0)
{
config_items.led_event_color_data[network][idx] = LED_COLOR_CYAN;
} else if( strncmp(color, "magenta", 6) == 0)
{
config_items.led_event_color_data[network][idx] = LED_COLOR_MAGENTA;
} else if( strncmp(color, "yellow", 6) == 0)
{
config_items.led_event_color_data[network][idx] = LED_COLOR_YELLOW;
} else
{
config_items.led_event_color_data[network][idx] = LED_EVENT_NONE;
}
}
}

print_console_type = ini_getl("Debug Print", "Port", CONSOLE_UART, inifile);
config_items.recording_period = ini_getl("Recording Period", "Recording_Period", 10, inifile);
config_items.low_power_mode = ini_getl("Low Power Mode", "Power_Mode",DOWN_DOWN_LP_MODE, inifile);
Expand Down Expand Up @@ -755,12 +734,7 @@ int get_print_console_type( void )

uint32_t get_event_watch_mode()
{
return event_watch_mode;
}

void set_event_watch_mode(uint32_t watch_mode)
{
event_watch_mode = watch_mode;
return config_items.event_watch_mode;
}

// Returns number of seconds to record data (audio or IMU data)
Expand Down Expand Up @@ -832,8 +806,8 @@ void printConfg(void)

printf("\n Operation mode=%d selected: %s\r\n", mode, config_items.mode_description);
printf(" Event Watching Mode: %s %s\r\n",
(event_watch_mode&WATCH_TYPE_AUDIO)?"Key-Word":"",
(event_watch_mode&WATCH_TYPE_MOTION)?"IMU-Motion":"");
(get_event_watch_mode()&WATCH_TYPE_AUDIO)?"Key-Word":"",
(get_event_watch_mode()&WATCH_TYPE_MOTION)?"IMU-Motion":"");

// Output recording feature driven by Low Power Mode Selection
if(config_items.low_power_mode == DOWN_DOWN_LP_MODE){
Expand Down
5 changes: 4 additions & 1 deletion src/fat_load.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#undef FLOATING_POINT_PRINTF_BUG

#define LED_EVENT_NUM 10
#define LED_NETWORK_NUM 2

enum FW_LOAD_TYPE {
BOOT_MODE_FLASH = 0,
Expand Down Expand Up @@ -116,7 +117,9 @@ enum WIF_CONFIG_TYPE {
struct config_ini_items {
/* save the settings from config.ini */
char button_switch[8]; /** [Function_x]-->Button_shift **/
int led_event_color[LED_EVENT_NUM]; /** [Led]-->IDXn **/
int event_watch_mode; /** [Function_x]-->event_watch_mode **/
int led_event_color[LED_EVENT_NUM];
int led_event_color_data[LED_NETWORK_NUM][ LED_EVENT_NUM]; /** [Led Network x]-->IDXn **/

int recording_period; /** [Recording Period]-->Recording_Period **/
int imu_write_to_file; /** [IMU data stream]-->Write_to_file **/
Expand Down
Loading

0 comments on commit 80ca704

Please sign in to comment.