【TI毫米波雷达笔记】MMWave配置流程避坑
在TI SDK目录下的mmwave.h文档说明中
强调了要按以下配置:
c
mmWave API
The mmWave API allow application developers to be abstracted from the lower layer drivers and the mmWave link API.
The mmWave file should be included in an application as follows:
#include <ti/control/mmwave/mmwave.h>
Initializing the module
The mmWave module is initialized by using the MMWave_init API The module can execute in either of the following domains:
XWR14xx: The module executes on the MSS
XWR16xx/XWR18xx/XWR68xx: The module executes on both the MSS and DSS
Synchronizing the module
Once the module has been initialized it has to be synchronized before it can be used. This is done using the MMWave_sync API. This is required because on the XWR16xx/XWR18xx/XWR68xx the module can execute on both the DSS and MSS. We need to ensure that the modules on each domain are operational before they can be used.
On the XWR14xx; the synchronization is not really required but in order to maintain the same API behavior between XWR14xx and XWR16xx/XWR18xx/XWR68xx the API needs to be invoked.
Opening the module
After the mmWave module has been synchronized; the mmWave module needs to be opened. This will initialize the mmWave link to the BSS. While operating in minimal mode applications can invoke the mmWave link API directly after this step has been initiated.
In cooperative mode; only one of the domains should be deemed responsible for opening the mmWave module.
Note
xWR18xx: If the BPM chirp is a valid chirp used for the current frame, then make sure custom calibration config (MMWave_OpenCfg_t::customCalibrationEnableMask) is used in MMWave_open to override the default calibration mask and adhere to the recommendation by mmwavelink.
Configuration of the module
Applications are responsible for populate and configuring the BSS using the configuration MMWave_config API. The API will take the application supplied configuration and will pass this to the BSS via the mmWave link API(s). Application developers are abstracted from the calling sequence and the various synchronization events which are required.
Once the configuration has been completed; the application can setup the data path. After the data path has been successfully configured application developers can start the mmWave.
The mmWave module can be configured by multiple domains but the applications should ensure that the configuration done by a domain be completed before the other domain initiates the configuration. Failure to do so will result in unpredictable behavior.
Starting the mmWave
After successful configuration the mmWave needs to be started using the MMWave_start API. On successful execution of the API the data path is being excercised.
Executing the mmWave module
The mmWave module requires an execution context which needs to be provided by the application. This is because there are asynchronous events and response messages which are received by the BSS using the mmWave Link infrastructure. Thes need to be handled and processed in the application supplied execution context.
Failure to provide and execution context and not invoking the MMWave_execute API can result in the mmWave API getting stuck and the application loosing synchronization with the other domains in the system.
Callback functions
While working in the cooperative mode the mmWave is executing on both the MSS and DSS. Each domain registers a callback function which is invoked by the mmWave module if the peer domain does an equivalent operation.
For example:- The table below illustrates an example flow of the mmWave API and the invocation of the callback function in the peer domain
MSS DSS
MMWave_open(&openCfg) openFxn (ptrOpenCfg)
cfgFxn (ptrControlCfg) MMWave_config (&ctrlCfg)
MMWave_start (&startCfg) startFxn (ptrStartCfg)
MMWave_stop () stopFxn ()
MMWave_close () closeFxn ()
Callback functions allow an application to be notified when an action has been taken. Along with this the equivalent parameters are also passed to the peer domain. This allows both the domains to remain synchronized
Error Code
The mmWave API return an encoded error code. The encoded error code has the following information:-
Error or Informational message
mmWave error code
Subsystem error code The mmWave module is a high level control module which is basically layered over multiple modules like the mmWave Link, Mailbox etc. When an mmWave API reports a failure it could be because of a multitude of reasons. Also the mmWave Link API reports certains errors as not fatal but informational. In order to satisfy these requirements the error code returned by the mmWave API is encoded. There exists a MMWave_decodeError which can be used to determine the exact error code and error level.
也就是按 MMWave_init - MMWave_sync - MMWave_open - MMWave_config进行配置
然后用 MMWave_start 开启 用 MMWave_stop 结束
但实际上在调用 MMWave_start 之前 还要用 MMWave_addChirp 和 MMWave_addProfile 来进行配置 如果有BPM模式还需要调用 MMWave_addBpmChirp
而这三个函数 都会返回一个handle值 同样需要一个全局变量handle来接收