This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM2634: How to Remove Semaphore from the UART library?

Part Number: AM2634

Tool/software:

Dear Ti team,

we want to use UART HAL library for NON-RTOS application but as per my understanding SEMAPHORE blocking our process, so can we remove the SEMAPHORE from UART library?

if yes, then how we can do so or we can LLD instead of HAL?

If anyone knows, please help me.

Thank you!

 

 

  • Hi Sahil,

    If you want to remove the semaphore from UART library I would recommend using the LLD.:

    software-dl.ti.com/.../DRIVERS_UART_LLD_PAGE.html

  • Hi Nilabh, 

    as per my understanding LLD drivers also blocking the process by MUTEX.

    int32_t transferOK;
    UART_Transaction transaction;
    intrNum = gUartInitObject[CONFIG_UART0].intrNum;
    gUartVimStsAddr = gVimBaseAddr + (0x404u + (((intrNum)>> 5) & 0xFu) * 0x20u);
    gUartVimStsClrMask = 0x1u << ((intrNum) & 0x1Fu);
    /* Send entry string */
    gNumBytesWritten = 0U;
    transaction.buf = &gUartBuffer[0U];
    strncpy(transaction.buf,"This is uart echo test blocking mode\r\nReceives 8 characters then echo's back. Please input..\r\n", APP_UART_BUFSIZE);
    transaction.count = strlen(transaction.buf);
    transferOK = UART_lld_writeIntr(gUartHandle0, transaction.buf, transaction.count, NULL);
    while(try_lock_mutex(gUartObject[CONFIG_UART0].writeTransferMutex) == MUTEX_ARM_LOCKED);
    APP_UART_ASSERT_ON_FAILURE(transferOK, transaction);
    /* Deregister IRQ */
    HwiP_setVecAddr(intrNum, 0);
    HwiP_setPri(intrNum, 15);
    what is the propose to use MUTEX because it's blocking the process.
    Our Requirements:
    1. we don't want to block the process.
    2. we want to use UART transmit in DMA mode and our process should not block because DMA is separate process from main processor.
    so now please tell us how to remove MUTEX also, it is necessary to remove MUTEX?
       
  • Hi Sahil, 

    You can remove the mutex as per your requirement, This is just an application demo where we are using blocking call. As it says in the statement.

    strncpy(transaction.buf,"This is uart echo test blocking mode\r\nReceives 8 characters then echo's back. Please input..\r\n", APP_UART_BUFSIZE);

    Let me know if you need any more info.