AnsweredAssumed Answered

Stm32f7 Discovery - UART DMA help needed

Question asked by grozea.ion on Jun 30, 2017

Hi,

I have the following issue when using the attached code:

board->computer

ABCDE\r\n

the computer dosent receive anything

i send from the computer "11\r\n"

the board reply is ABCD

basically there is one step delay between receiving/sending the message

 

the code in the main  is shown below

 

int main(void)
{
MPU_Config();
CPU_CACHE_Enable();
#ifdef RTE_CMSIS_RTOS // when using CMSIS RTOS
osKernelInitialize(); // initialize CMSIS-RTOS
#endif
HAL_Init();
BSP_SDRAM_Init();
/* Configure the System clock to have a frequency of 216 MHz */
SystemClock_Config();
myGPIO_Init();
myNVIC_Init();
myADC_Init();
myUART_Init();

...

//#ifdef RTE_CMSIS_RTOS // when using CMSIS RTOS
Init_GUIThread();
osKernelStart(); // start thread execution
//#endif
// startFIFO();
myTime = HAL_GetTick();
for(cnt=0; cnt<7;cnt++)
TxBuffer[cnt] = cnt+65;
TxBuffer[7] = '\n';
SendToXbee(8);

while (1)
{

Battery_Val = getBattery();
if(HAL_GetTick() > myTime)
{
myToogle = !myToogle;
if(myToogle){
//XBeeOn;
myRxSize = Xbee_available();
if(myRxSize){
printf("Buffer has %d bytes\r\n", myRxSize);
for(cnt = 0; cnt < myRxSize; cnt++)
TxBuffer[cnt] = Xbee_get();
TxBuffer[cnt++] = '\r';
TxBuffer[cnt++] = '\n';
SendToXbee(myRxSize+2);
}
//printf("DMA data remaining: %d \r\n", myDMA_Remain);
//sprintf((char *)TxBuffer, "Battery Value is %d \r\n", Battery_Val);
//SendToXbee(TxBuffer, sizeof(TxBuffer));
}else {
//XBeeOff;
}
myTime += 50;
}

osDelay(10);

}

 

Can anyone help me to understand what i am doing wrong?

Thank you

Attachments

Outcomes