diff --git a/.vscode/settings.json b/.vscode/settings.json index 92362dd..7473550 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -5,5 +5,6 @@ ], "nrf-connect.boardRoots": [ "${workspaceFolder}/firmware" - ] + ], + "cmake.sourceDirectory": "C:/Projekte/buzzer_2/firmware/libs/ble_mgmt" } \ No newline at end of file diff --git a/firmware/VERSION b/firmware/VERSION index 3bc071b..72bcbd0 100644 --- a/firmware/VERSION +++ b/firmware/VERSION @@ -1,6 +1,6 @@ VERSION_MAJOR = 0 VERSION_MINOR = 0 -PATCHLEVEL = 2 +PATCHLEVEL = 6 VERSION_TWEAK = 0 #if (IS_ENABLED(CONFIG_LOG)) EXTRAVERSION = debug diff --git a/firmware/boards/iten/buzzy/buzzy.dts b/firmware/boards/iten/buzzy/buzzy.dts index cc1006e..5446b5c 100644 --- a/firmware/boards/iten/buzzy/buzzy.dts +++ b/firmware/boards/iten/buzzy/buzzy.dts @@ -149,7 +149,7 @@ reg = <0>; spi-max-frequency = <8000000>; jedec-id = [c2 28 17]; - size = ; + size = ; has-dpd; t-enter-dpd = <10000>; t-exit-dpd = <35000>; @@ -183,7 +183,7 @@ // compatible = "nordic,qspi-nor"; // reg = <0>; // jedec-id = [c2 28 17]; -// size = ; +// size = ; // has-dpd; // t-enter-dpd = <10000>; // t-exit-dpd = <35000>; diff --git a/firmware/fs/buzzy.json b/firmware/fs/buzzy.json new file mode 100644 index 0000000..67451e9 --- /dev/null +++ b/firmware/fs/buzzy.json @@ -0,0 +1,23 @@ +{ + "firmware_config": { + "peripheral": "QSPI", + "compress": true + }, + "pins": { + "sck": 2, + "csn": 5, + "io0": 29, + "io1": 30, + "io2": 31, + "io3": 45 + }, + "flash_size": 8388608, + "sck_frequency": 8000000, + "address_mode": "MODE24BIT", + "readoc": "READ4IO", + "writeoc": "PP4IO", + "pp_size": "PPSIZE256", + "sck_delay": 0, + "rx_delay": 2, + "page_size": 4096 +} diff --git a/firmware/fs/buzzy.toml b/firmware/fs/buzzy.toml new file mode 100644 index 0000000..b9d9cfb --- /dev/null +++ b/firmware/fs/buzzy.toml @@ -0,0 +1,46 @@ +[qspi] + mem_size = 0x800000 + read_mode = "READ4IO" + write_mode = "PP4IO" + address_mode = "BIT24" + frequency = "M16" + spi_mode = "MODE0" + rx_delay = 2 + wip_index = 0 + page_program_size = "PAGE256" + retain_ram = true + + # Pin-Zuweisungen (angepasst an die Netlist) + [qspi.sck] + delay = 0x80 + pin = 2 + port = 0 + + [qspi.csn] + pin = 5 + port = 0 + + [qspi.dio0] + pin = 29 + port = 0 + + [qspi.dio1] + pin = 30 + port = 0 + + [qspi.dio2] + pin = 31 + port = 0 + + [qspi.dio3] + pin = 13 + port = 1 + + [qspi.custom] + io2_level = "LEVEL_LOW" + io3_level = "LEVEL_HIGH" + # Aktiviert Quad-IO und High-Performance Mode für Macronix MX25R + instructions = [ + {command=0x06, data=[]}, + {command=0x01, data=[0x40, 0, 0x2]} + ] \ No newline at end of file diff --git a/firmware/fs/program.bat b/firmware/fs/program.bat new file mode 100644 index 0000000..2a210a8 --- /dev/null +++ b/firmware/fs/program.bat @@ -0,0 +1 @@ +nrfutil device --x-ext-mem-config-file buzzy.json program --firmware \\10.0.10.30\edi\nrf_playground\lasertag\firmware\tools\littlefs_generator\lfs_external_flash.hex --options verify=VERIFY_READ,reset=RESET_SYSTEM \ No newline at end of file diff --git a/firmware/libs/audio/Kconfig b/firmware/libs/audio/Kconfig index ed0fb48..bb19377 100644 --- a/firmware/libs/audio/Kconfig +++ b/firmware/libs/audio/Kconfig @@ -1,6 +1,6 @@ menuconfig AUDIO bool "Audio handling" - default y + default n select I2S select POLL diff --git a/firmware/libs/ble_mgmt/src/ble_mgmt.c b/firmware/libs/ble_mgmt/src/ble_mgmt.c index 5208421..50edbdc 100644 --- a/firmware/libs/ble_mgmt/src/ble_mgmt.c +++ b/firmware/libs/ble_mgmt/src/ble_mgmt.c @@ -246,8 +246,10 @@ int ble_mgmt_init(ble_mgmt_rx_cb_t rx_cb, const char *device_name) } const char *name_to_use = (device_name != NULL) ? device_name : CONFIG_BLE_MGMT_DEFAULT_DEVICE_NAME; + LOG_INF("BLE init: set_device_name"); set_device_name(name_to_use); + LOG_INF("BLE init: bt_le_adv_start"); rc = bt_le_adv_start(&adv_param, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (rc) { diff --git a/firmware/pm_static.yml b/firmware/pm_static.yml new file mode 100644 index 0000000..908036e --- /dev/null +++ b/firmware/pm_static.yml @@ -0,0 +1,5 @@ +# External Flash +littlefs_storage: + address: 0x0 + size: 0x800000 + region: external_flash \ No newline at end of file diff --git a/firmware/prj.conf b/firmware/prj.conf index 270c9b0..02659f9 100644 --- a/firmware/prj.conf +++ b/firmware/prj.conf @@ -1,5 +1,7 @@ ### Logging CONFIG_LOG=y +CONFIG_LOG_MODE_DEFERRED=y +CONFIG_LOG_PROCESS_THREAD=y CONFIG_AUDIO_LOG_LEVEL_DBG=y ### Bluetooth @@ -15,4 +17,4 @@ CONFIG_PM_DEVICE=y ### Stack CONFIG_MAIN_STACK_SIZE=2048 CONFIG_INIT_STACKS=y -CONFIG_THREAD_STACK_INFO=y +CONFIG_THREAD_STACK_INFO=y \ No newline at end of file diff --git a/firmware/program.bat b/firmware/program.bat new file mode 100644 index 0000000..2a210a8 --- /dev/null +++ b/firmware/program.bat @@ -0,0 +1 @@ +nrfutil device --x-ext-mem-config-file buzzy.json program --firmware \\10.0.10.30\edi\nrf_playground\lasertag\firmware\tools\littlefs_generator\lfs_external_flash.hex --options verify=VERIFY_READ,reset=RESET_SYSTEM \ No newline at end of file diff --git a/firmware/src/main.c b/firmware/src/main.c index eab4cd5..a8a45bc 100644 --- a/firmware/src/main.c +++ b/firmware/src/main.c @@ -5,7 +5,7 @@ #include "fs_mgmt.h" #include "buzz_proto.h" #include "fw_mgmt.h" -#include "audio.h" +// #include "audio.h" LOG_MODULE_REGISTER(main); @@ -44,6 +44,7 @@ void ble_rx_cb(const uint8_t *data, uint16_t len) buzz_proto_buf_free(&buf); /* Speicher bei Fehler sofort wieder freigeben */ } } + #endif int main(void) @@ -55,13 +56,19 @@ int main(void) LOG_ERR("Failed to initialize BLE management: %d", rc); return rc; } + LOG_WRN("After BLE init"); +#else + LOG_WRN("BLE not enabled"); #endif - LOG_INF("Init complete."); + LOG_WRN("Main park loop active"); - k_sleep(K_MSEC(500)); - LOG_INF("Playing test audio files..."); - audio_queue_play("/lfs/sys/update", false); - audio_queue_play("/lfs/sys/confirm", false); - k_sleep(K_FOREVER); + // k_sleep(K_MSEC(500)); + // LOG_INF("Playing test audio files..."); + // audio_queue_play("/lfs/sys/update", false); + // audio_queue_play("/lfs/sys/confirm", false); + for (;;) { + int32_t rem_ms = k_sleep(K_FOREVER); + LOG_WRN("main woke unexpectedly (remaining=%d ms)", rem_ms); + } } \ No newline at end of file