Wednesday, February 21st 2018, 12:30pm UTC+1

You are not logged in.

  • Login
  • Register

Reply

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Message information
Message
Settings
Automatically converts internet addresses into links by adding [url] and [/url] around them.
Smiley code in your message such as :) is automatically displayed as image.
You can use BBCode to format your message, if this option is enabled.
Security measure

Please enter the letters that are shown in the picture below (without spaces, and upper or lower case can be used).

The last 3 posts

Tuesday, February 13th 2018, 10:51am

by SANTHOSH KUMAR

Hi Til,

Thankyou for your reply. I have tried the way you suggested, it worked well. Thank You.

Tuesday, February 13th 2018, 8:02am

by SEGGER - Til

Hello Santhosh,

I don't know which device you are actually using but it should work the same with embOS.
embOS does not have any influence on your DMA or Uart.
IRQ interrupts are handled via embOS with a low level interrupt handler in assembler and a high level interrupt handler in your RTOSInit.c.
Could you please check your MMU table in the RTOSInit.c?
It defines which memory regions are cached.
That could be an issue because the DMA writes directly to the memory and you are maybe just reading old data from the cache.
In this case you would need to invalidate that memory region in the cache.

If you like you can contact us per email (you'll find the embOS support email address in the embOS manual in chapter "Support") and we'll have a look in your project.
Maybe we can find something obvious.

Best regards,
Til

Tuesday, February 13th 2018, 7:35am

by SANTHOSH KUMAR

USART DMA not receving data with embOS

Hi, I am trying to integrate my code with embOS for ARM. I am trying to send and receive data through usart using DMA. When i run code with out integrating with embOS it is working fine for both Tx & Rx. After integrating with embOS Tx is working fine and DMA Rx is not receiving data but usart RHR is getting value.

USART is configured for normal mode, baud rate is 9600, parity - None, stop bits - 1.


Thanks & Regards.
Santhosh


DMA settings and recevie code is given below.

static void _ConfigureDma( void )
{
uint32_t dwCfg;
uint8_t iController;
/* Driver initialize */
DMAD_Initialize( &dmad, 0 );
/* IRQ configure */
IRQ_ConfigureIT(ID_DMAC0, 0, ISR_DMA);
IRQ_EnableIT(ID_DMAC0);
/* Allocate DMA channels for USART */
usartDmaTxChannel = DMAD_AllocateChannel( &dmad,
DMAD_TRANSFER_MEMORY, ID_USART);
usartDmaRxChannel = DMAD_AllocateChannel( &dmad,
ID_USART, DMAD_TRANSFER_MEMORY);
if ( usartDmaTxChannel == DMAD_ALLOC_FAILED
|| usartDmaRxChannel == DMAD_ALLOC_FAILED )
{
printf("DMA channel allocat error\n\r");
while(1);
}
/* Set RX callback */
DMAD_SetCallback(&dmad, usartDmaRxChannel,
(DmadTransferCallback)_DmaRxCallback, 0);
/* Configure DMA RX channel */
iController = (usartDmaRxChannel >> 8);
dwCfg = 0
| DMAC_CFG_SRC_PER(
DMAIF_Get_ChannelNumber( iController, ID_USART, DMAD_TRANSFER_RX ))
| DMAC_CFG_SRC_H2SEL
| DMAC_CFG_SOD
| DMAC_CFG_FIFOCFG_ALAP_CFG;
DMAD_PrepareChannel( &dmad, usartDmaRxChannel, dwCfg );
/* Configure DMA TX channel */
iController = (usartDmaTxChannel >> 8);
dwCfg = 0
| DMAC_CFG_DST_PER(
DMAIF_Get_ChannelNumber( iController, ID_USART, DMAD_TRANSFER_TX ))
| DMAC_CFG_DST_H2SEL
| DMAC_CFG_SOD
| DMAC_CFG_FIFOCFG_ALAP_CFG;
DMAD_PrepareChannel( &dmad, usartDmaTxChannel, dwCfg );
}


static void _DmaRx( void )
{
sDmaTransferDescriptor td;
td.dwSrcAddr = (uint32_t)&USART->US_RHR;
td.dwDstAddr = (uint32_t) pBuffer;
td.dwCtrlA = BUFFER_SIZE | DMAC_CTRLA_SRC_WIDTH_BYTE | DMAC_CTRLA_DST_WIDTH_BYTE;
td.dwCtrlB = DMAC_CTRLB_SRC_DSCR | DMAC_CTRLB_DST_DSCR
| DMAC_CTRLB_SIF_AHB_IF2 | DMAC_CTRLB_DIF_AHB_IF0
| DMAC_CTRLB_FC_PER2MEM_DMA_FC
| DMAC_CTRLB_SRC_INCR_FIXED
| DMAC_CTRLB_DST_INCR_INCREMENTING;
td.dwDscAddr = 0;
DMAD_PrepareSingleTransfer(&dmad, usartDmaRxChannel, &td);
DMAD_StartTransfer(&dmad, usartDmaRxChannel);
}