Hi,
I am trying to read floating point data from the Red Pitaya's DDR memory in C. I have studied Pavel's ADC Recorder code and FPGA design and have made a simple modification by adding a Xilinx Floating Point Unit (FPU) converter directly after the ADC data (both 32 bits AXI Addr Width either way). I have verified that I have the parameters are set correctly for the FPU as I can write my own uint16 data on the cfg bus and read the correct floating point value on the sts bus, suffice to say it seems to work just fine when using the BRAM.
I am 'fairly' confident that this is just a coding issue, as I can simply connect the ADC data back to the Packetizer for the RAM with no other changes and then that correctly acquire the uint16 ADC data when the DDR RAM is configured back to handle uint16. However, in addition to this I have seen other designs which handle floating point such as the Sdr transeiver emb and I have tried to adapt my code to suit but it is has been quite difficult to see the reasoning behind certain things.
My code is the same as Pavel's except for the line were the RAM is mapped and where the float is stored:
float *ram = (float *)mmap(NULL, pow(2,6)*sysconf(_SC_PAGESIZE), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0x10000000); // starting address
*size = pow(2,16
float value2[4];
for(j=0; j < pow(2,16); ++j){
value2[0] = ram[j];
printf("%d\n",ram[j]);
//printf("%hu\t%f\t%f\n",j,ram[j],buffer[j]);
//printf("%hu\t%f\n",*(uint16_t *)(cfg + 12),*(float *)(sts + 0));
}
I have tried various lines of codes to try and read the floating point data from RAM but cant seem to figure it out. I am not sure if there are certain constraints with working with the DDR RAM, but I just assumed it would be the same since two uint16's are the same length as a float. Using a union was one possible idea I had, but I am not sure how efficient that would, I am also trying to cut down on the number of computations I do in the CPU and just wish to obtain a 'final' value which can be streamed over TCP directly, just like in Pavel's designs.
Any help would be greatly appreciated, many thanks!
Regards, Ren
Reading floating point data from RAM
- renegade264
- Posts: 15
- Joined: Mon Apr 08, 2019 1:08 pm
Re: Reading floating point data from RAM
Problem solved the day after, the Red Pitaya just needed a restart for some reason, probably some residual misconfiguration with the memory mapping code.
Regards, Ren
Regards, Ren
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie
Who is online
Users browsing this forum: No registered users and 29 guests