azinke / mmwave

Linux tool for controlling the MMWCAS-DSP-EVM and MMWAVECAS-RF-EVM boards
MIT License
32 stars 7 forks source link

"TDA Armin failed!" when just recording #2

Open chuber1986 opened 1 year ago

chuber1986 commented 1 year ago

When performing configuration and recording in one step everything works fine

$ ./mmwave --capture-dir testdir1 --configure --record
STARTSTATUS    0 | DEV MAP: 32 | [MMWCAS-DSP] TDA Connected!
STATUS    0 | DEV MAP:  1 | [MASTER] Power up successful!
STATUS    0 | DEV MAP:  1 | [MASTER] Firmware successfully uploaded!
STATUS    0 | DEV MAP:  1 | [MASTER] CRC type has been set!
STATUS    0 | DEV MAP:  1 | [MASTER] RF successfully enabled!
STATUS    0 | DEV MAP:  1 | [MASTER] Channels successfully configured!
STATUS    0 | DEV MAP:  1 | [MASTER] ADC output format successfully configured!
STATUS    0 | DEV MAP:  1 | [MASTER] Init completed with sucess

STATUS    0 | DEV MAP:  2 | [SLAVE] Power up successful!
STATUS    0 | DEV MAP:  4 | [SLAVE] Power up successful!
STATUS    0 | DEV MAP:  8 | [SLAVE] Power up successful!
STATUS    0 | DEV MAP: 14 | [SLAVE] Firmware successfully uploaded!
STATUS    0 | DEV MAP: 14 | [SLAVE] CRC type has been set!
STATUS    0 | DEV MAP: 14 | [SLAVE] RF successfully enabled!
STATUS    0 | DEV MAP: 14 | [SLAVE] Channels successfully configured!
STATUS    0 | DEV MAP: 14 | [SLAVE] ADC output format successfully configured!
STATUS    0 | DEV MAP: 14 | [SLAVE] Init completed with sucess

STATUS    0 | DEV MAP: 15 | [ALL] RF deivce configured!
STATUS    0 | DEV MAP: 15 | [ALL] LDO Bypass configuration successful!
STATUS    0 | DEV MAP: 15 | [ALL] Data format configuration successful!
STATUS    0 | DEV MAP: 15 | [ALL] Low Power Mode configuration successful!
STATUS    0 | DEV MAP: 15 | [ALL] RF successfully initialized!
STATUS    0 | DEV MAP: 15 | [ALL] Datapath configuration successful!
STATUS    0 | DEV MAP: 15 | [ALL] Profile configuration successful!
STATUS    0 | DEV MAP: 15 | [ALL] Chirp configuration successful!
STATUS    0 | DEV MAP:  1 | [MASTER] Frame configuration completed!
STATUS    0 | DEV MAP: 14 | [SLAVE] Frame configuration completed!
STATUS    0 | DEV MAP: 15 | [MIMO] Configuration completed!

STATUS    0 | DEV MAP: 32 | [MMWCAS-DSP] Arming TDA
STATUS    0 | DEV MAP: 15 | [MMWCAS-RF] Framing ...
STATUS    0 | DEV MAP: 32 | [MMWCAS-RF] Stop recording

When I'm just recording (directly after the command above) I get the following error message:

$ ./mmwave --capture-dir testdir2 --record
STARTSTATUS   -8 | DEV MAP: 32 | [MMWCAS-DSP] TDA Arming failed!

Same thing happen when I do the configuration only and then try to record a frame:

./mmwave --configure
STARTSTATUS    0 | DEV MAP: 32 | [MMWCAS-DSP] TDA Connected!
STATUS    0 | DEV MAP:  1 | [MASTER] Power up successful!
STATUS    0 | DEV MAP:  1 | [MASTER] Firmware successfully uploaded!
STATUS    0 | DEV MAP:  1 | [MASTER] CRC type has been set!
STATUS    0 | DEV MAP:  1 | [MASTER] RF successfully enabled!
STATUS    0 | DEV MAP:  1 | [MASTER] Channels successfully configured!
STATUS    0 | DEV MAP:  1 | [MASTER] ADC output format successfully configured!
STATUS    0 | DEV MAP:  1 | [MASTER] Init completed with sucess

STATUS    0 | DEV MAP:  2 | [SLAVE] Power up successful!
STATUS    0 | DEV MAP:  4 | [SLAVE] Power up successful!
STATUS    0 | DEV MAP:  8 | [SLAVE] Power up successful!
STATUS    0 | DEV MAP: 14 | [SLAVE] Firmware successfully uploaded!
STATUS    0 | DEV MAP: 14 | [SLAVE] CRC type has been set!
STATUS    0 | DEV MAP: 14 | [SLAVE] RF successfully enabled!
STATUS    0 | DEV MAP: 14 | [SLAVE] Channels successfully configured!
STATUS    0 | DEV MAP: 14 | [SLAVE] ADC output format successfully configured!
STATUS    0 | DEV MAP: 14 | [SLAVE] Init completed with sucess

STATUS    0 | DEV MAP: 15 | [ALL] RF deivce configured!
STATUS    0 | DEV MAP: 15 | [ALL] LDO Bypass configuration successful!
STATUS    0 | DEV MAP: 15 | [ALL] Data format configuration successful!
STATUS    0 | DEV MAP: 15 | [ALL] Low Power Mode configuration successful!
STATUS    0 | DEV MAP: 15 | [ALL] RF successfully initialized!
STATUS    0 | DEV MAP: 15 | [ALL] Datapath configuration successful!
STATUS    0 | DEV MAP: 15 | [ALL] Profile configuration successful!
STATUS    0 | DEV MAP: 15 | [ALL] Chirp configuration successful!
STATUS    0 | DEV MAP:  1 | [MASTER] Frame configuration completed!
STATUS    0 | DEV MAP: 14 | [SLAVE] Frame configuration completed!
STATUS    0 | DEV MAP: 15 | [MIMO] Configuration completed!

$ ./mmwave --capture-dir testdir2 --record
STARTSTATUS   -8 | DEV MAP: 32 | [MMWCAS-DSP] TDA Arming failed!

Do you have any hint what the problem is there?

BR Christian

azinke commented 1 year ago

Hi @chuber1986 , Indeed, using the options --configure and --record separately does not work as expected. My initial guess would be that the MMWL_ArmingTDA function is failing either because of a closed connection with the board or "still in use". Not sure what's the cause yet.

I could investigate this a little further. Do you mind testing when I ready a branch for this?!

I've developed this with the hardware of the university but I've finished my studies already. I'm planning to acquire a board myself but, for now, I couldn't directly implement and test bug fixes or new features

chuber1986 commented 1 year ago

Hi @azinke,

sure, I can test that! :) Just let me know then the branch is ready.

BR Christian

chuber1986 commented 1 year ago

Hi @azinke !

Sorry, for the late answer. In this commit are 2 errors:

  1. In int MMWL_ConfigureDeviveMap(unsigned char deviceMap) {} you return retVal once which is not define. This should be status, I guess. For consistency I'd rename status to retVal.
  2. In int MMWL_ConfigureDeviveMap(unsigned char deviceMap) {} the timeOutCnt valiable was not defined.

After fixing these it again compiles, but unfortunately it doesn't fix the issue. I still get $ ./mmwave record --capture-dir testdir2 STATUS 0 | DEV MAP: 32 | [MMWCAS-DSP] TDA Connected! STATUS -8 | DEV MAP: 32 | [MMWCAS-DSP] TDA Arming failed!

BR Christian

azinke commented 1 year ago

Hi @chuber1986 !

Thank you very much for the feedback and sorry for the late response. It also took me some time to spot the issue with the "arming" without the board. But I also received helpful debugging logs to investigate this issue.

I've added a new commit to the Pull Request. Could you please test it and let me know of the outcome?! Thanks!

chuber1986 commented 1 year ago

Hi @azinke!

Unfortunately, I still get the same error:

> ./mmwave --help
usage: mmwave [command] [option]

Configuration and control tool for TI MMWave Evaluation Modules

Arguments:
    configure                      Configure the MMWCAS-RF-EVM board
    record                         Trigger data recording. This assumes that configuration is completed.
      -d,  --capture-dir           Name of the director where to store recordings on the DSP board
      -p,  --port                  Port number the DSP board server app is listening on
      -i,  --ip                    IP Address of the MMWCAS DSP evaluation module
      -t,  --time                  Indicate how long the recording should last in minutes. Default: 1 min
      -f,  --cfg                   TOML Configuration file. Overwrite the default config when provided
      -h,  --help                  Print CLI option help and exit.
      -v,  --version               Print program version and exit.

> ./mmwave --version
mmwave 0.1, Copyright (C) 2022 - 2023

> ./mmwave configure
STATUS    0 | DEV MAP: 32 | [MMWCAS-DSP] TDA Connected!
STATUS    0 | DEV MAP: 15 | [MMWCAS-DSP] TDA Initialized!
STATUS    0 | DEV MAP:  1 | [MASTER] Power up successful!
STATUS    0 | DEV MAP:  1 | [MASTER] Firmware successfully uploaded!
STATUS    0 | DEV MAP:  1 | [MASTER] CRC type has been set!
STATUS   -8 | DEV MAP:  1 | [MASTER] Error: Failed to enable master RF

> ./mmwave configure -f config/short-range-cfg.toml
STATUS    0 | DEV MAP: 32 | [MMWCAS-DSP] TDA Connected!
STATUS    0 | DEV MAP: 15 | [MMWCAS-DSP] TDA Initialized!
STATUS    0 | DEV MAP:  1 | [MASTER] Power up successful!
STATUS    0 | DEV MAP:  1 | [MASTER] Firmware successfully uploaded!
STATUS    0 | DEV MAP:  1 | [MASTER] CRC type has been set!
STATUS   -8 | DEV MAP:  1 | [MASTER] Error: Failed to enable master RF

> ./mmwave configure -f config/very-short-range-cfg.toml
STATUS    0 | DEV MAP: 32 | [MMWCAS-DSP] TDA Connected!
STATUS    0 | DEV MAP: 15 | [MMWCAS-DSP] TDA Initialized!
STATUS    0 | DEV MAP:  1 | [MASTER] Power up successful!
STATUS    0 | DEV MAP:  1 | [MASTER] Firmware successfully uploaded!
STATUS    0 | DEV MAP:  1 | [MASTER] CRC type has been set!
STATUS    0 | DEV MAP:  1 | [MASTER] RF successfully enabled!
STATUS    0 | DEV MAP:  1 | [MASTER] Channels successfully configured!
STATUS    0 | DEV MAP:  1 | [MASTER] ADC output format successfully configured!
STATUS    0 | DEV MAP:  1 | [MASTER] Init completed with sucess

STATUS    0 | DEV MAP:  2 | [SLAVE] Power up successful!
STATUS    0 | DEV MAP:  4 | [SLAVE] Power up successful!
STATUS    0 | DEV MAP:  8 | [SLAVE] Power up successful!
STATUS    0 | DEV MAP: 14 | [SLAVE] Firmware successfully uploaded!
STATUS    0 | DEV MAP: 14 | [SLAVE] CRC type has been set!
STATUS    0 | DEV MAP: 14 | [SLAVE] RF successfully enabled!
STATUS    0 | DEV MAP: 14 | [SLAVE] Channels successfully configured!
STATUS    0 | DEV MAP: 14 | [SLAVE] ADC output format successfully configured!
STATUS    0 | DEV MAP: 14 | [SLAVE] Init completed with sucess

STATUS    0 | DEV MAP: 15 | [ALL] RF deivce configured!
STATUS    0 | DEV MAP: 15 | [ALL] LDO Bypass configuration successful!
STATUS    0 | DEV MAP: 15 | [ALL] Data format configuration successful!
STATUS    0 | DEV MAP: 15 | [ALL] Low Power Mode configuration successful!
STATUS    0 | DEV MAP: 15 | [ALL] RF successfully initialized!
STATUS    0 | DEV MAP: 15 | [ALL] Datapath configuration successful!
STATUS    0 | DEV MAP: 15 | [ALL] Profile configuration successful!
STATUS    0 | DEV MAP: 15 | [ALL] Chirp configuration successful!
STATUS    0 | DEV MAP:  1 | [MASTER] Frame configuration completed!
STATUS    0 | DEV MAP: 14 | [SLAVE] Frame configuration completed!
STATUS    0 | DEV MAP: 15 | [MIMO] Configuration completed!

STATUS    0 | DEV MAP: 32 | [MMWCAS-DSP] TDA successfully disconnected!

> ./mmwave record
STATUS    0 | DEV MAP: 32 | [MMWCAS-DSP] TDA Connected!
STATUS   -8 | DEV MAP: 32 | [MMWCAS-DSP] TDA Arming failed!
azinke commented 1 year ago

Hi @chuber1986 ! Have you maybe forgotten to fetch the new update before building the source? In the latest update, I've moved the "Frame Configuration" steps in the record command. And it seems to be appearing in configure in the logs. I mean, these lines

STATUS    0 | DEV MAP:  1 | [MASTER] Frame configuration completed!
STATUS    0 | DEV MAP: 14 | [SLAVE] Frame configuration completed!

With a custom configuration file, the commands would be as follows:

# Prepare the DSP board for recording
./mmwave configure -f config/short-range-cfg.toml

# Trigger recording
./mmwave record -f config/short-range-cfg.toml

But it's also possible to use the default config

# Prepare the DSP board for recording
./mmwave configure

# Trigger recording
./mmwave record
chuber1986 commented 1 year ago

Morning @azinke ,

you are right. It seams that my git-pull failed without me recognizing it. Now I get:

> ./mmwave configure -f config/v
ery-short-range-cfg.toml
STATUS    0 | DEV MAP: 32 | [MMWCAS-DSP] TDA Connected!
STATUS    0 | DEV MAP: 15 | [MMWCAS-DSP] TDA Initialized!
STATUS    0 | DEV MAP:  1 | [MASTER] Power up successful!
STATUS    0 | DEV MAP:  1 | [MASTER] Firmware successfully uploaded!
STATUS    0 | DEV MAP:  1 | [MASTER] CRC type has been set!
STATUS    0 | DEV MAP:  1 | [MASTER] RF successfully enabled!
STATUS    0 | DEV MAP:  1 | [MASTER] Channels successfully configured!
STATUS    0 | DEV MAP:  1 | [MASTER] ADC output format successfully configured!
STATUS    0 | DEV MAP:  1 | [MASTER] Init completed with sucess

STATUS    0 | DEV MAP:  2 | [SLAVE] Power up successful!
STATUS    0 | DEV MAP:  4 | [SLAVE] Power up successful!
STATUS    0 | DEV MAP:  8 | [SLAVE] Power up successful!
STATUS    0 | DEV MAP: 14 | [SLAVE] Firmware successfully uploaded!
STATUS    0 | DEV MAP: 14 | [SLAVE] CRC type has been set!
STATUS    0 | DEV MAP: 14 | [SLAVE] RF successfully enabled!
STATUS    0 | DEV MAP: 14 | [SLAVE] Channels successfully configured!
STATUS    0 | DEV MAP: 14 | [SLAVE] ADC output format successfully configured!
STATUS    0 | DEV MAP: 14 | [SLAVE] Init completed with sucess

STATUS    0 | DEV MAP: 15 | [ALL] RF deivce configured!
STATUS    0 | DEV MAP: 15 | [ALL] LDO Bypass configuration successful!
STATUS    0 | DEV MAP: 15 | [ALL] Data format configuration successful!
STATUS    0 | DEV MAP: 15 | [ALL] Low Power Mode configuration successful!
STATUS    0 | DEV MAP: 15 | [ALL] RF successfully initialized!
STATUS    0 | DEV MAP: 15 | [ALL] Datapath configuration successful!
STATUS    0 | DEV MAP: 15 | [ALL] Profile configuration successful!
STATUS    0 | DEV MAP: 15 | [ALL] Chirp configuration successful!
STATUS    0 | DEV MAP: 15 | [MIMO] Configuration completed!

STATUS    0 | DEV MAP: 32 | [MMWCAS-DSP] TDA successfully disconnected!

> ./mmwave record -f config/very-short-range-cfg.toml
STATUS    0 | DEV MAP: 32 | [MMWCAS-DSP] TDA Connected!
STATUS   -2 | DEV MAP:  1 | [MASTER] Frame configuration failed!

I tried to do the PowerUp before recording (right after connecting to the TDA), but the same error occurs. Any ideas?

azinke commented 1 year ago

Could you provide a log with debugging enabled?! It would allow us to spot where exactly the issue is coming from

# define DEBUG 1
chuber1986 commented 1 year ago

The full debug output from the configuration: conf_log.txt

and from the recording: rec_log.txt

BR, Christian

touxiaoling commented 6 days ago

Hello, I am currently using both the MMWCAS-RF-EVM and MMWCAS-DSP-EVM boards as well. When trying to separate the configure and record functionalities using the fix-2-multi-record branch, I encountered the same issue.

Is there anything I can do to help move this issue forward?

chuber1986 commented 6 days ago

Hello, sorry, we didn't find a solution to this problem. Also a college of mine play with that radar and couldn't find a viable solution for large scale data collection. The support from TI is also not too helpful....

touxiaoling commented 3 days ago

@chuber1986 Hello, I found that by simply duplicating the following section of code under mimo.c once more, two MMW recordings can be achieved.

    status = MMWL_ArmingTDA(tdaCfg);
    check(status,
      "[MMWCAS-DSP] Arming TDA",
      "[MMWCAS-DSP] TDA Arming failed!\n", 32, TRUE);

    msleep(2000);

    // Start framing
    for (int i = 3; i >=0; i--) {
      status += MMWL_StartFrame(1U << i);
    }
    check(status,
      "[MMWCAS-RF] Framing ...",
      "[MMWCAS-RF] Failed to initiate framing!\n", config.deviceMap, TRUE);

    msleep((unsigned long int)record_duration);

    // Stop framing
    for (int i = 3; i >= 0; i--) {
      status += MMWL_StopFrame(1U << i);
    }

    status += MMWL_DeArmingTDA();
    check(status,
      "[MMWCAS-RF] Stop recording",
      "[MMWCAS-RF] Failed to de-arm TDA board!\n", 32, TRUE);
    msleep(1000);

To work around this issue, I created a Python binding to this library. Using the code below, it’s possible to perform multiple recordings:

import time
import mmwcas

record_duration = 1*60
status = mmwcas.mmw_set_config(dict())

status = mmwcas.mmw_init()

# First recording
time.sleep(2)
status = mmwcas.mmw_arming_tda("outdoor0")
time.sleep(2)
status = mmwcas.mmw_start_frame()
time.sleep(record_duration)
status = mmwcas.mmw_stop_frame()
status = mmwcas.mmw_dearming_tda()
time.sleep(2)

# Second recording
status = mmwcas.mmw_arming_tda("outdoor1")
time.sleep(2)
status = mmwcas.mmw_start_frame()
time.sleep(record_duration)
status = mmwcas.mmw_stop_frame()
status = mmwcas.mmw_dearming_tda()

For more details, you can check https://github.com/touxiaoling/mmwave. To run the mimo.py file, you need to install the Python Cython library and then compile by running python setup.py build_ext --inplace. After that, simply run python mimo.py to view the results.

I hope this helps.

chuber1986 commented 1 day ago

That great, thank you very much!