Skip to content

Commit

Permalink
Updated ME18's BLE_datc example to locally run datsc_connected.py. Re…
Browse files Browse the repository at this point in the history
…solved hard-fault error.
  • Loading branch information
crsz20 committed Sep 20, 2024
1 parent ff0fd7c commit 0232186
Showing 1 changed file with 50 additions and 14 deletions.
64 changes: 50 additions & 14 deletions Examples/MAX32690/Bluetooth/BLE_datc/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,9 @@ static void mainWsfInit(void)

uint16_t memUsed;
WsfCsEnter();
memUsed = WsfBufInit(numPools, mainPoolDesc);
memUsed = WsfBufCalcSize(numPools, mainPoolDesc);
WsfHeapAlloc(memUsed);
WsfBufInit(numPools, mainPoolDesc);
WsfCsExit();

WsfOsInit();
Expand Down Expand Up @@ -213,27 +214,62 @@ int main(void)
mainLlRtCfg.defTxPwrLvl = DEFAULT_TX_POWER;
#endif

uint32_t memUsed;
WsfCsEnter();
memUsed = WsfBufIoUartInit(WsfHeapGetFreeStartAddress(), PLATFORM_UART_TERMINAL_BUFFER_SIZE);
WsfHeapAlloc(memUsed);
WsfHeapAlloc(PLATFORM_UART_TERMINAL_BUFFER_SIZE);
WsfBufIoUartInit(WsfHeapGetFreeStartAddress(), PLATFORM_UART_TERMINAL_BUFFER_SIZE);
WsfCsExit();

mainWsfInit();
AppTerminalInit();

#if defined(HCI_TR_EXACTLE) && (HCI_TR_EXACTLE == 1)

uint32_t llmemUsed;

/* Calculate how much memory we will need for the LL initialization */

WsfCsEnter();
LlInitRtCfg_t llCfg = { .pBbRtCfg = &mainBbRtCfg,
.wlSizeCfg = 4,
.rlSizeCfg = 4,
.plSizeCfg = 4,
.pLlRtCfg = &mainLlRtCfg,
.pFreeMem = WsfHeapGetFreeStartAddress(),
.freeMemAvail = WsfHeapCountAvailable() };

memUsed = LlInit(&llCfg);
WsfHeapAlloc(memUsed);

WsfTraceEnable(FALSE);

LlInitRtCfg_t llCfg = {
.pBbRtCfg = &mainBbRtCfg,
.wlSizeCfg = 4,
.rlSizeCfg = 4,
.plSizeCfg = 4,
.pLlRtCfg = &mainLlRtCfg,
/* Not significant yet, only being used for memory size requirement calculation. */
.pFreeMem = WsfHeapGetFreeStartAddress(),
/* Not significant yet, only being used for memory size requirement calculation. */
.freeMemAvail = WsfHeapCountAvailable()
};

llmemUsed = LlInitSetBbRtCfg(llCfg.pBbRtCfg, llCfg.wlSizeCfg, llCfg.rlSizeCfg, llCfg.plSizeCfg,
llCfg.pFreeMem, llCfg.freeMemAvail);

llCfg.pFreeMem += llmemUsed;
llCfg.freeMemAvail -= llmemUsed;

llmemUsed += LlInitSetLlRtCfg(llCfg.pLlRtCfg, llCfg.pFreeMem, llCfg.freeMemAvail);

#if (WSF_TOKEN_ENABLED == TRUE) || (WSF_TRACE_ENABLED == TRUE)
WsfTraceEnable(TRUE);
#endif

/* Complete the LL initialization */
/* Allocate the memory */
WsfHeapAlloc(llmemUsed);

/* Set the free memory pointers */
llCfg.pFreeMem = WsfHeapGetFreeStartAddress();
llCfg.freeMemAvail = WsfHeapCountAvailable();

/* Run the initialization with properly set the free memory pointers */
if (llmemUsed != LlInit(&llCfg)) {
WSF_ASSERT(0);
}


WsfCsExit();

bdAddr_t bdAddr;
Expand Down

0 comments on commit 0232186

Please sign in to comment.