This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AWR1642BOOST: Radar Studio capture file (opening from MATLAB)

Part Number: AWR1642BOOST
Other Parts Discussed in Thread: AWR1642

Hi

I managed to capture some binary files using Radar Studio & High Speed Data Converter Pro (using AWR1642BOOST,MMWAVE-DEVPACK, and TSW1400 hardware).

Post processing using Radar Studio works fine. I now need to do some manual processing in MATLAB, so i import/open the binary in MATLAB

fileID = fopen('adc_data.bin'); A = fread(fileID);

whos A in MATLAB is returning: 

Name Size Bytes Class Attributes

A 16711680x1 133693440 double

Now when i had a look at the data, it seems to be 8 bit (value ranges from 0-255) instead of the expected 16 bits (0-65535).  i believe the data are 16 bit (and yes, in HSDC Pro i did load the corresponding 16 bit firmware , not the 14 or 12 one). In "Codes" and "Bits" View of the waveform it's definitely 16 bits.

Importing it as a 'uint16' seems to fixed the issue.

Could you please confirm this? 

Thanks

  • Hi Maksudi

    The code given below will help you get started. I am assuming that you

    1. are enabling all four channels. 

    2. using the complex1X or complex2X mode. 

    3. using both LVDS lanes. 

     

    Samples_Per_ChirpConfig = 256; % complex samples per chirp

    Number_of_channels = 4;

    ChirpConfigs_Per_Chirp = 1;

    Chirps_Per_Frame = 64

    Number_of_Frames = 1;

     

    % Open the file and read the data.
    fileID = fopen(adc_file_name,'r');
    % TSW1400 converts ADC data to offset binary. Convert it back to 2's
    % complement.
    radar_data = fread(fileID,total_samples,'uint16')-2^15;
    fclose(fileID);

    % radar_data has data in the following format.
    % Rx0I0, Rx0Q0, Rx0I1, Rx0Q1, Rx0I2, Rx0Q2, Rx0I3, Rx0Q3, ...
    % The following script reshapes it into a 4-dimensional array.

    radar_data = reshape(radar_data, 2*Samples_Per_ChirpConfig, Number_of_channels, ChirpConfigs_Per_Chirp, Chirps_Per_Frame, Number_of_Frames);

    % Convert the data to complex
    radar_data_real = radar_data(1:2:end, :, :, :, :);
    radar_data_complex = radar_data(2:2:end, :, :, :, :);
    radar_data = radar_data_real + 1i*radar_data_complex;

    % Permute the dimensions of the array are so that they are of the format
    % [Channels, Samples, Chirps, ChirpTypes, Frames]

    radar_data = permute(radar_data, [2,1,3,4,5]);

     

    Regards

    Anil

  • Hi Anil,

    thanks for your reply. I've only got chance to get back into this again as i was pulled into another tasks :-(

    My configuration is actually:

    1. 1 channel only

    2. complex2X mode.

    3. 1 LVDS lanes (because #1 above-only using 1 channel)

    I originally did this simple read in MATLAB (below) but obviously wasn't the right way/format (it was obvious when i compare the matlab plot waveform against the plot in High Speed Data Converter.Also i noticed in MATLAB i got 8355840 samples (workspace says A is 8355840Xdouble whereas High Speed Data Converter display 65535 samples? FYI my binary filesize is 16,320 KB

    %my incorrect code starta

    fileID = fopen('adc_data.bin');

    A = fread(fileID,'uint16');

    plot(A);

    %my incorrect code end

    I am still not clear of these parameters you specified in your example script: (unable to find corresponding parameter in Radar Studio)

    Samples_Per_ChirpConfig

    ChirpConfigs_Per_Chirp

    I'd imagine the convert data to complex part and permute would be identical for my case?

    Thanks

  • Hi Maksudi,

    Apologies for the confusion. Please use the code given below.

    Samples_Per_Chirp = 256; % complex adc samples per chirp

    Number_of_channels = 1;

    Chirps_Per_Frame = 64

    Number_of_Frames = 1;

    total_samples = 2 * Samples_Per_Chirp * Number_of_channels * Chirps_Per_Frame * Number_of_Frames;

    % Open the file and read the data.
    fileID = fopen(adc_file_name,'r');

    % TSW1400 converts ADC data to offset binary. Convert it back to 2's
    % complement.
    radar_data = fread(fileID,total_samples,'uint16')-2^15;
    fclose(fileID);

    % radar_data has data in the following format.
    % Rx0I0, Rx0Q0, Rx0I1, Rx0Q1, Rx0I2, Rx0Q2, Rx0I3, Rx0Q3, ...
    % The following script reshapes it into a 4-dimensional array.

    radar_data = reshape(radar_data, 2*Samples_Per_Chirp, Number_of_channels, Chirps_Per_Frame, Number_of_Frames);

    % Convert the data to complex
    radar_data_real = radar_data(1:2:end, :, :, :);
    radar_data_complex = radar_data(2:2:end, :, :, :);
    radar_data = radar_data_real + 1i*radar_data_complex;

    % Permute the dimensions of the array are so that they are of the format
    % [Channels, Samples, Chirps, Frames]

    radar_data = permute(radar_data, [2,1,3,4]);

     

    The 'Samples_Per_ChirpConfig' and 'ChirpConfigs_Per_Chirp' are intended for cases where different kinds of chirps (created by sending multiple chirpConfig APIs) are looped through in a frame.

    Regards

    Anil

  • Also, please use both LVDS channels for the above code to work.
  • Hello again Anil. Thanks. I have been on annual leave and just got back again to work.

    Would it be simpler if i just read the ADC using real number format? (in my case real number is OK).

    If that's the case can i just do a simple read? (or is there a specific format?)-an example script would be nice-thanks.

    The reason is that today i tried capturing using real number format then load the binary into HSDC Pro, displaying it using "Code" as axis, then i also do a simple read on matlab, do a plot.

    I compared the result they are not the same so i guess there is something that i don't quite understand here ?

    Thanks

  • Hi,

    We apologize for not answering you latest questions earlier.

    Please let us know if this is an issue or if you were able to answer these questions yourself

    thank you
    Cesar
  • HI Cesar

    No worries, we were also sort of putting it on hold for a while and just started it again so it is a very good timing!

    To answer your question no it has not been resolved or progressed.

    Basically we'll probably be just doing single channel RX , 16 bit on real mode, 

    Thanks

  • Hello Maksudi,

    Apologies for the delay.

    The AWR1642 is optimized for complex adc data, and so, I'd recommend that you work in the complex adc modes (either complex1x, or complex2x). Real-only mode is a legacy mode, meant for customers who have existing software that support only real data.

    However, if you still want to use real data, use the code given below.

    Samples_Per_Chirp = 256; % real adc samples per chirp

    Number_of_channels = 1;

    Chirps_Per_Frame = 64

    Number_of_Frames = 1;

    total_samples = Samples_Per_Chirp * Number_of_channels * Chirps_Per_Frame * Number_of_Frames;

    % Open the file and read the data.
    fileID = fopen(adc_file_name,'r');

    % TSW1400 converts ADC data to offset binary. Convert it back to 2's
    % complement.
    radar_data = fread(fileID,total_samples,'uint16')-2^15;
    fclose(fileID);

    % radar_data has real data in the following format.
    % Rx0I0, Rx0I2, Rx0I1, Rx0I3, ...
    radar_data = reshape(radar_data,4,[]);

    radar_data = radar_data([1 3 2 4],:);

    % The following script reshapes it into a 4-dimensional array.

    radar_data = reshape(radar_data, Samples_Per_Chirp, Number_of_channels, Chirps_Per_Frame, Number_of_Frames);

    % [Channels, Samples, Chirps, Frames]

    radar_data = permute(radar_data, [2,1,3,4]);

    Regards

    Anil