cancel
Showing results for 
Search instead for 
Did you mean: 

Transmit large data through UART OR Ethernet

AElta.1
Associate II

hello everyone

I followed the AN4666 to read data from GPIOC ports triggered by timer input capture mode and save into a large buffer of uint8 in size of (510000) arrays, all I want to do is to transmit the full buffer after the reading operations is complete to my pc.

I have tried transmitting it through UART but I realized that the maximum size I can transmit is 65535 bytes before it stops. also if I used circular mode the the pointer will start from the beginning.

/* Includes ------------------------------------------------------------------*/
#include "main.h"
* USER CODE BEGIN PD */
#define MAX_FRAME_SIZE 458745 
/* Private variables ---------------------------------------------------------*/
TIM_HandleTypeDef htim1;
TIM_HandleTypeDef htim2;
DMA_HandleTypeDef hdma_tim1_ch1;
 
UART_HandleTypeDef huart3;
DMA_HandleTypeDef hdma_usart3_tx;
 
PCD_HandleTypeDef hpcd_USB_OTG_FS;
 
/* USER CODE BEGIN PV */
const uint8_t aFull_Buffer[MAX_FRAME_SIZE];
/* USER CODE END PD */
int main(void)
{
htim1.hdma[TIM_DMA_ID_CC1]->XferCpltCallback = TransferComplete;
// Start DMA in interrupt mode, specify source and destination
  	HAL_DMA_Start_IT(htim1.hdma[TIM_DMA_ID_CC1], GPIOC_IDR, (uint32_t) &aFull_Buffer, MAX_FRAME_SIZE);
  	// Enable timer to trigger DMA transfer - CC1DE bit
  	__HAL_TIM_ENABLE_DMA(&htim1, TIM_DMA_CC1);
  	// Enable timer input capture
  	HAL_TIM_IC_Start(&htim1, TIM_CHANNEL_1);
while (1) {
}}
static void TransferComplete(DMA_HandleTypeDef *hdma_tim1_ch1) {
HAL_UART_Transmit_DMA(&huart3,aFull_Buffer,MAX_FRAME_SIZE );
}

I was able to receive only 65535 bytes because I know that (max size of transmit function is 16 bits= 65535)

  1. can I do multiple uart transmissions but with different start points from my buffer?
  2. Is there a way to transmit data through Ethernet ?
3 REPLIES 3

DMA has a 16-bit UNIT COUNT limit

It you want to send more, you simply break the transaction into multiple, smaller, manageable chunks.

The interrupt load has been decimated to the 5th order, so isn't consequential.

What's Ethernet packet size limit? Like 1500 bytes?

Ethernet typically has 10x or 100x the speed of Async Serial, and more reliable.

Layer on TCP/IP and you can use UDP and TCP sockets to move data.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

I have thought of this where I can separate my aFull_Buffer into for example 5 DATA buffers each is 65535 bytes in size then transmit each one of them, unfortunately using it this way will put some constrains on the MAX_FRAME_SIZE that I can use because of RAM_D1 size, my main goal is to have the buffer as maximum as I can so I can do some processing on it.

  1. can I save my aFull_Buffer into Flash memory, then make 5 DATA buffers in RAM_D1 that reads from aFull_Buffer, where each DATA buffer save specific value of the main buffer equals to 65535 bytes, then transmit the 5 DATA buffers through Multiple UART Transmission ?

ps: I can not minimize the aFull_Buffer size to 65535 because I need as much continuous data read from the GPIOC as possible without any interrupts.

as for the Ethernet do u have any examples that I can use in NUCLEO-h743ZI2 board, I did some research on it put the NUCLEO-h743ZI2 has give a warning that the eth can work only when ram is pointing at 0x24000000.