Succesfullky receives ADC data from module
This commit is contained in:
BIN
BF_companion
BIN
BF_companion
Binary file not shown.
61
main.c
61
main.c
@ -629,26 +629,75 @@ int main(int argc, char** argv) {
|
|||||||
//printf("L502_REGS_IOHARD_OUTSWAP_BFCTL reg:");
|
//printf("L502_REGS_IOHARD_OUTSWAP_BFCTL reg:");
|
||||||
//BF_exec_cmd_simple(hnd, 0x8006, L502_REGS_IOHARD_OUTSWAP_BFCTL, 1); //reaf fpga reg
|
//BF_exec_cmd_simple(hnd, 0x8006, L502_REGS_IOHARD_OUTSWAP_BFCTL, 1); //reaf fpga reg
|
||||||
|
|
||||||
|
uint32_t streams_enable_Err = 0;
|
||||||
|
streams_enable_Err = X502_StreamsEnable(hnd, X502_STREAM_ADC );
|
||||||
|
printf("Streams start 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);
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("start streams sampling\n");
|
//printf("start streams sampling\n");
|
||||||
BF_exec_cmd_with_arr(hnd, 0x8004U, 0, NULL, 0, 1); //setup and start streams
|
//BF_exec_cmd_with_arr(hnd, 0x8004U, 0, NULL, 0, 1); //setup and start streams
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint32_t waiting_cnt = 1;
|
uint32_t waiting_cnt = 1;
|
||||||
//waiting_cnt = 1000;
|
waiting_cnt = 1000;
|
||||||
printf("\nwaiting %d ...", waiting_cnt);
|
printf("\nwaiting %d ...", waiting_cnt);
|
||||||
while(--waiting_cnt){;}
|
while(--waiting_cnt){;}
|
||||||
//for(uint32_t timeout = 100000000; timeout; --timeout){;}
|
//for(uint32_t timeout = 100000000; timeout; --timeout){;}
|
||||||
printf("done\n");
|
printf("done\n");
|
||||||
|
|
||||||
printf("get counters of calls of SPORT_RX, SPORT_TX, HDMA_RX, HDMA_TX\n");
|
printf("\n\nget counters of calls of SPORT_RX, SPORT_TX, HDMA_RX, HDMA_TX\n");
|
||||||
BF_exec_cmd_with_arr(hnd, 0x8005U, 100, NULL, 0, 1);
|
BF_exec_cmd_with_arr(hnd, 0x8005U, 100, NULL, 0, 1);
|
||||||
|
|
||||||
|
|
||||||
printf("get a some data made by sport isr handler\n");
|
printf("\n\nget a some data made by sport isr handler\n");
|
||||||
BF_exec_cmd_with_arr(hnd, 0x8006U, 100, NULL, 0, 1);
|
BF_exec_cmd_with_arr(hnd, 0x8006U, 100, NULL, 0, 1);
|
||||||
BF_exec_cmd_with_arr(hnd, 0x8006U, 100, NULL, 0, 3);
|
//BF_exec_cmd_with_arr(hnd, 0x8006U, 100, NULL, 0, 3);
|
||||||
|
|
||||||
|
|
||||||
|
printf("receiving data...\n");
|
||||||
|
|
||||||
|
uint32_t inp_buff[1024] = {0,};
|
||||||
|
uint32_t ready_cnt = 0;
|
||||||
|
|
||||||
|
uint32_t ready_cnt_Err = 0;
|
||||||
|
uint32_t recv_Err_code = 0;
|
||||||
|
|
||||||
|
|
||||||
|
ready_cnt_Err = X502_GetRecvReadyCount(hnd, &ready_cnt);
|
||||||
|
recv_Err_code = X502_Recv(hnd, inp_buff, 1024, 10);
|
||||||
|
|
||||||
|
|
||||||
|
printf("Ready count: %d, Err: %d \n", ready_cnt, ready_cnt_Err);
|
||||||
|
printf("Recv Err code (<0 -- err, >= 0 -- number of received words(32bit)): %d\n", recv_Err_code);
|
||||||
|
|
||||||
|
|
||||||
|
printf("\n\nreceived data:\n");
|
||||||
|
int values_in_line = 0;
|
||||||
|
for (int i = 0; i < 1024; ++i){
|
||||||
|
char bin_str_val[9] = {0,};
|
||||||
|
uin32_t_to_bin(inp_buff[i], bin_str_val);
|
||||||
|
printf(" 0x%08X,", inp_buff[i]);
|
||||||
|
//printf(" 0b%s,", bin_str_val);
|
||||||
|
++values_in_line;
|
||||||
|
if (values_in_line == 10){
|
||||||
|
printf("\n");
|
||||||
|
values_in_line = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user