Mavlink_msg_obstacle_distance message problem

I made a simple routine to test mavlink communication STM32 to PX4, it sends a mavlink msg on every heartbeat from the vehicle. I send a debug msg first and i can see it is updated in qgc but when i’m starting to send the distance msg then the debug msg is not updated anymore and i don’t get any distance representation in qgc either. What could be wrong with the code?
/Send Mavlink debug msg/
/Pack debug msg/
mavlink_msg_debug_pack(1, 2, &msg_tx, 1 , count, count1.2);
/Copy debug msg to buffer/
len = mavlink_msg_to_send_buffer(buf, &msg_tx);
/Send debug msg_tx/
UARTSEndBuff_Send(buf, len);
Send Distance */
const int distance_array_size = 72;
int dist_min = 2;
int dist_max = 900;
int sen_type = 1;
int angle_increment = 5;
/Initialize distance data/
uint16_t distances[distance_array_size];
for(int i=0; i<distance_array_size; i++)
distances[i] = UINT16_MAX;
/Test distance/
distances[0] = 50;
mavlink_msg_obstacle_distance_pack(1, 2, &msg_tx, count, sen_type, distances, angle_increment, dist_min, dist_max);
len = mavlink_msg_to_send_buffer(buf, &msg_tx);
/Send distance/
UARTSEndBuff_Send(buf, len);