DotBots / DotBot-firmware

Firmware applications used to control DotBots and SailBots
http://www.dotbots.org
BSD 3-Clause "New" or "Revised" License
5 stars 8 forks source link

Add support for 4 simulatenous Lighthouse basestations to the LH2 bsp #268

Closed SaidAlvarado closed 5 months ago

SaidAlvarado commented 7 months ago

For the experiment with mobile lighthouse basestations we need the DotBots to be able to receive beams from 4 lighthouses at the same. Not necessarily process them all, but at least support polynomials from mode 3 and 4 of the basestations.

Tasks:

SaidAlvarado commented 7 months ago

Questions for @aabadie. In lh2.c why is the spi_rx_buffer[64], but the lh2_buffer_t[128] ? the former gets directly copied into the other, why is the latter so big ?

SaidAlvarado commented 7 months ago

Remember you hardcoded the value of the lighth imlementation .c file in bsp/bsp.emProject

<project Name="00bsp_dotbot_lh2_4">
    <configuration
      Name="Common"
      project_dependencies="00bsp_timer_hf"
      project_directory="."
      project_type="Library" />
    <file file_name="nrf/lh2_4.c" />  
    <!-- Remember to change this back to nrf/$(Lh2ImplementationFile) -->
    <file file_name="lh2_4.h" />
  </project>

Change it back when you're done.

SaidAlvarado commented 7 months ago

SEGGER fails to build any project when the nRF53 solutions are selected (tested with DotBot v2, and nRF53_App solutions). It gives no description for the error, it just says it failed. I checked that the SEGGER Nordic package was up to date.

Ask @aabadie for help next monday, for now, work on the nRF52DK

SaidAlvarado commented 7 months ago

Ask @filmak why the function demodulate_light() requires a 128 byte sample buffer, when the SPI is only programmed to read 64 bytes. There should only be 64 bytes worth of information arriving in that buffer.

SaidAlvarado commented 7 months ago

In _determine_polynomial(), most errors occur in the first 2 bits of start_val. If you set start_val to 3 and bits_N_for_comp to 47-3, the amounts of times the microcontroller needs to redo the weights computation is severely reduced.

If you set start_val to 9, it almost never has to redo, except in the case of a poly error.

SaidAlvarado commented 7 months ago

Small detour to fix #270

SaidAlvarado commented 7 months ago

Benchmark 11-Jan-2024 - 1:

Notes:

SaidAlvarado commented 7 months ago

Note, I don't know how, in one occasion during testing reverse_count_p got stuck because the lsfr buffer reached 0x0000 and then got stuck there forever. Add an emergency condition to check for that and return an error.

image