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.

CC2541: DMA Channel and BLE Device Monitor

Part Number: CC2541
Other Parts Discussed in Thread: CC2540,

Hi,

My customer is using all DMA channels as below and want to use additional DMA for UART communication. Would you please help how to use additional DMA? It seems difficult to use DMA 0,1,2 channels for UART, is there a way to share DMA 3,4 channels that are used for IR TIMER1 with UART?

DMA0: Flash

DMA1,2: AES

DMA3,4: IR TIMER1

Another question is compatibility issue with BLE stack v.1.3.2 on BLE Device Monitor. There is error on 'Event Log' window but there is no issue with BLE stack v.1.41. My customer can't use BLE stack v.1.4x since they can't update IAR compiler version. Could you please help where I can get BLE Device Monitor which is compatible with BLE stack v.1.3.2?

Host: COM6 115200 baud no flows.

HCI_Ext_Build_Revision: status=00 Rev=34414

BLE Host TI BLE 1.32 (obsolete) CC2540

Thanks,

Shaka

  • Hi Shaka,

    As long as your are not using UART and IR at the same time, you can definitely share the DMA resource between those 2.

    Have you tried using BTool to see if it works?
  • Hi Christin,

    For sharing DMA resources, Can you please send a example code?

    Yes, we have used BTool and found it works with BLE stack v.1.3.2, but we need to use BLE Device monitor which is compatible with BLE stack v.1.3.2.

    Thanks,

    Shaka

  • Hi Shaka,

    In order to share DMA you first need to identify what DMA consumers can share.

    1. Do you have full control over when AES will need DMA?
    2. Do you have full control over when UART will need DMA?
    3. Do you have full control over when IR will need DMA?
    4. Do you have full control over when Flash will need DMA?

    If you can answer Yes to two of the above questions, then you can share DMA channels. Sharing itself is easy. Before using the DMA each user (Flash, AES, UART or IR) must assume that configuration is invalid. An example is the HalFlashWrite() routine. This routine completely configures the DMA before each access. As long as no one else uses the DMA while this routine executes it's safe for the routine to use the DMA. The only thing that can corrupt it, are interrupts. It is possible to disable interrupts to make sure that doesn't happen. Disabling interrupts can be dangerous for real-time systems however, such as running a BLE stack. Thus, it is not recommended to disable interrupts for longer periods of time (>few hundreds of microseconds)

    I would recommend that you write a separate module that can grant access to use the DMA channel you want to share. Each module must then request access from your new module before it can configure, and use, the DMA,  After use it should call your new module to release its access to the DMA channel.

    Keep in mind the possibilities of interrupt driven operations that use the DMA. This ties into whether you can answer Yes to the questions listed above.

  • Hi Shaka,

    Btool can do everything that BLE device monitor is doing, including OAD, so basically there is no difference between those tools other that its user interface. Is there any reason that you can only use device monitor?
  • Hi Torbjorn,

    Thank you for your detail explanation, we are studying your suggestion. Is there any example code that we can refer to?

    Would you please advice for a new issue in below?
    BLE connection disconnected. We are using HalFlashWrite() when writing data to internal Flash while CC2541 communicate with CC2540 thru BLE. Please also refer to below connection settings on Btool.
    Min Connection Interval: 6
    Max Connection Interval: 6
    Slave Latency: 60
    Supervision Timeout: 100
    Would you please recommend more reliable method for storing data into Flash?

    Hi Christine,

    Thank you for your answer. We can use Btool instead.

    Thanks,
    Shaka
  • Hi Shaka,

    What example code do you refer to? There is already a good example of how to configure DMA in HalFlashWrite().

    In terms of writing to NV. Please use osal_snv_read/write. This module will in turn call HalFlashWrite(). However, it minimizes the number of calls to HalFlashErase(). The latter can take 20ms, which can be quite problematic with fast connection interval. The best would be to synchronize the call with the effective connection event. Flash should be accessed right after this connection event.