This commit is contained in:
2025-09-16 13:24:28 +03:00
parent a1dec94f1f
commit cf8bdd5b5c
3 changed files with 51 additions and 21 deletions

Binary file not shown.

68
main.c
View File

@ -711,12 +711,12 @@ long int X502_Raw_User_Data_Parser(uint32_t *inp_buff, uint32_t inp_values_N,
if (BF_msg.raw_value & 0x800000){ // if first bit is nonzero -- it is negative value
BF_msg.value_int *= -1;
}
printf("Received USR msg: 0x%06H\n", BF_msg.raw_value);
printf("Received USR msg: 0x%06H \n", BF_msg.raw_value);
//}else if (raw_header & 0b01100000 == 0b01100000){ //
}else if (BF_msg.raw_header & 0b01101010 == 0b01101010){ //new Frequency Sweep Started. So save old (*FFT_data)to FFT_data_done and start working with new FFT_data
//FFT
printf("Received: new LFSM started. msg payload: 0x%06H\n", BF_msg.raw_value);
printf("Received: new LFSM started. msg payload: 0x%06H \n", BF_msg.raw_value);
(*FFT_data)-> rcv_state = 0xFF; // data filled
int FFT_last_ID = (*FFT_data)-> ID;
int FFT_points_max_N = (*FFT_data)-> max_N;
@ -1070,7 +1070,7 @@ int main(int argc, char** argv) {
uint32_t streams_enable_Err = 0;
streams_enable_Err = X502_StreamsEnable(hnd, X502_STREAM_ADC | X502_STREAM_DIN );
printf("Streams start err: %d \n", streams_enable_Err);
printf("Streams enable err: %d \n", streams_enable_Err);
uint32_t streams_start_Err = 0;
streams_start_Err = X502_StreamsStart(hnd);
printf("Streams start err: %d \n", streams_start_Err);
@ -1105,25 +1105,23 @@ int main(int argc, char** argv) {
//BF_exec_cmd_with_arr(hnd, 0x8006U, 100, NULL, 0, 3);
printf("\nStart transparent mode\n");
BF_exec_cmd_simple(hnd, 0x8007, 10, 1); //start transparent
printf("\Flushed from receiving buff: %d\n", X502_FlushRcv_buff(hnd));
printf("receiving data...\n");
uint32_t *inp_buff = malloc(1024*100*1024*2*4);
double *adc_data = malloc(1024*1024*sizeof(double));
//uint32_t inp_buff[1024*2048] = {0,};
int ready_cnt = 0;
int ready_cnt_copy = 0;
uint32_t ready_cnt_Err = 0;
uint32_t recv_Err_code = 0;
printf("\nStart transparent mode\n");
BF_exec_cmd_simple(hnd, 0x8007, 10, 1); //start transparent
printf("\nFlushed from receiving buff: %d\n", X502_FlushRcv_buff(hnd));
printf("receiving data...\n");
ready_cnt_Err = X502_GetRecvReadyCount(hnd, &ready_cnt_copy);
recv_Err_code = X502_Recv(hnd, inp_buff, 1024, 10);
@ -1141,7 +1139,10 @@ int main(int argc, char** argv) {
}
int data_receive_trys_counter = 100;
uint32_t max_total_words = 10000;
uint32_t max_total_words = 100000;
printf("\nflush TX buff. \n Number of free TX descriptors before flushing:");
BF_exec_cmd_simple(hnd, 0x8010, 10, 1);
receive_data(hnd, logfilename, inp_buff, data_receive_trys_counter, max_total_words);
/*
@ -1153,8 +1154,15 @@ int main(int argc, char** argv) {
printf("\nStart averaging mode\n");
printf("\nflush TX buff. \n Number of free TX descriptors before flushing:");
BF_exec_cmd_simple(hnd, 0x8010, 10, 1);
// X502_StreamsStop(hnd);
// X502_StreamsStart(hnd);
BF_exec_cmd_simple(hnd, 0x8008, 2, 1); //start averaging
printf("\Flushed from receiving buff: %d\n", X502_FlushRcv_buff(hnd));
// BF_exec_cmd_simple(hnd, 0x8007, 2, 1); //start transparent
printf("\nFlushed from receiving buff: %d\n", X502_FlushRcv_buff(hnd));
@ -1167,26 +1175,48 @@ int main(int argc, char** argv) {
data_receive_trys_counter = 100;
max_total_words = 10000;
max_total_words = 100000;
// void receive_data(t_x502_hnd hnd, FILE* logfile_ptr, uint32_t* inp_buff, int data_receive_trys_counter, uint32_t max_total_words)
printf("\n dbg value: ");
BF_exec_cmd_simple(hnd, 0x800A, 10, 1);
receive_data(hnd, logfilename, inp_buff, data_receive_trys_counter, max_total_words);
printf("\n dbg value: ");
BF_exec_cmd_simple(hnd, 0x800A, 10, 1);
printf("\nStart transparent mode\n");
BF_exec_cmd_simple(hnd, 0x8007, 10, 1); //start averaging
printf("\Flushed from receiving buff: %d\n", X502_FlushRcv_buff(hnd));
printf("\nflush TX buff. \n Number of free TX descriptors before flushing:");
BF_exec_cmd_simple(hnd, 0x8010, 10, 1);
BF_exec_cmd_simple(hnd, 0x8007, 10, 1); //start averaging
printf("\nFlushed from receiving buff: %d\n", X502_FlushRcv_buff(hnd));
printf("\n dbg value: ");
BF_exec_cmd_simple(hnd, 0x800A, 10, 1);
receive_data(hnd, logfilename, inp_buff, data_receive_trys_counter, max_total_words);
printf("\n dbg value: ");
BF_exec_cmd_simple(hnd, 0x800A, 10, 1);
printf("\nStart averaging mode\n");
printf("\nflush TX buff. \n Number of free TX descriptors before flushing:");
BF_exec_cmd_simple(hnd, 0x8010, 10, 1);
BF_exec_cmd_simple(hnd, 0x8008, 2, 1); //start averaging
printf("\Flushed from receiving buff: %d\n", X502_FlushRcv_buff(hnd));
printf("\nFlushed from receiving buff: %d\n", X502_FlushRcv_buff(hnd));
printf("\n dbg value: ");
BF_exec_cmd_simple(hnd, 0x800A, 10, 1);
receive_data(hnd, logfilename, inp_buff, data_receive_trys_counter, max_total_words);
printf("\n dbg value: ");
BF_exec_cmd_simple(hnd, 0x800A, 10, 1);

View File

@ -49,8 +49,8 @@ if __name__ == "__main__":
for key, val in data.items():
if (key.count("_N") + key.count("_hex")) == 0:
#print(key+"_hex :", data[key+"_hex"])
#chart.add_trace(go.Scatter(x=data[key+"_N"], y=data[key], name=key, mode="lines", text=data[key+"_hex"]))
chart.add_trace(go.Scatter(x=data[key+"_N"], y=data[key], name=key, mode="lines+markers", text=data[key+"_hex"]))
chart.add_trace(go.Scattergl(x=data[key+"_N"], y=data[key], name=key, mode="lines", text=data[key+"_hex"]))
# chart.add_trace(go.Scattergl(x=data[key+"_N"], y=data[key], name=key, mode="lines+markers", text=data[key+"_hex"]))
chart.update_layout(title=argv[1])
chart.show()