cancel
Showing results for 
Search instead for 
Did you mean: 

send a file from tera term pro(XMODEM-CRC) and received it in stm32f429zi board

naveenchandran
Associate II

i try to send a .txt file(1KB) from tera term pro(transfer>xmodem>send>select file with CRC)  and i want to received the file on stm32f429zi controller. but , tera term monitor was blank and i check with stm-side also in live expression but no values received ....i will attach the and photos. please check

((void process_xmodem_packet(uint8_t *packet, uint16_t packet_size) {

// Assuming you have implemented xmodem_verify_packet and xmodem_calculate_crc functions

if (xmodem_verify_packet(packet, packet_size)) {

 

} else {

// Packet is invalid, handle error (e.g., request packet retransmission)

// ...

}

}

 

void send_ack(void) {

 

HAL_UART_Transmit(&huart2, (uint8_t *)"\x06", 1, HAL_MAX_DELAY);

}

 

void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) {

static xmodem_packet_t xmodem_packet;

static uint16_t packet_index = 0;

 

// Process Xmodem packet

if (rx_buffer[0] == SOH) {

// Start of Header, begin a new packet

packet_index = 0;

} else if (rx_buffer[0] == EOT) {

// End of Transmission, file transfer complete

// Add your file handling logic here, e.g., save the received data to a file

 

// Send an ACK to acknowledge the EOT

send_ack();

} else {

// Regular data byte, add to the packet buffer

xmodem_packet.data[packet_index++] = rx_buffer[0];

 

// Check if the packet is complete

if (packet_index == XMODEM_BLOCK_SIZE) {

// Process the complete packet

xmodem_calculate_crc(xmodem_packet.data, XMODEM_BLOCK_SIZE, &xmodem_packet.crc);

 

// Verify the packet

if (xmodem_verify_packet(&xmodem_packet, XMODEM_BLOCK_SIZE)) {

// Packet is valid, process it as needed

// ...

} else {

// Packet is invalid, handle error (e.g., request packet retransmission)

// ...

}

 

// Send an ACK to acknowledge the packet

send_ack();

 

// Start a new packet

packet_index = 0;

}

}

 

// Resume receiving data

HAL_UART_Receive_IT(&huart2, rx_buffer, 1);

}))

2 REPLIES 2

Expect as a developer that you're going to need to debug your own code. Understand the anticipated interactions.

Random screen shots and code fragments aren't going to do it.

Your STM32 side code is going to need to send some initiating bytes to indicate it is ready for data reception.

For X-MODEM-1K this would be 'C' characters. Perhaps once a second until data starts flowing.

The protocol is over 3 decades old, I'd expect there to be working examples out their, and it's always be sufficiently well document to implement from scratch.

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

i can't find the exact examples