lighthouse-fpga Code on UPduino(UP5K) and HX8K Dev. Kit

Topics related to the Lighthouse positioning system, configuration and use
Post Reply
flower
Beginner
Posts: 3
Joined: Fri Jan 15, 2021 8:37 am

lighthouse-fpga Code on UPduino(UP5K) and HX8K Dev. Kit

Post by flower »

Hello everyone,
first of all I would like to thank you for all the great work in this brilliant project :shock: ! I wish I had discovered this a little earlier.

Currently I have some issues get the code (lighthouse-fpga) running correctly.

My Setup:
- ice40up5k (UPduino board) as well as an ice40-HX8K dev. kit
- Several custom boards with the PBW34S and TS4231 (identical setup like on the lighthouse-4 deck HW)
- I used them in an other project and I am quite confident that they do what they are supposed to do :roll:
- 1x Lighthouse 2 (Channel 1)

Background:
- In the past I have mainly used VHDL for FPGAs but now as I have seen SpinalHDL :o WOW, what a nice way to describe hardware

What I've done so far:
For the UP5K board, I had to change the 12MHz external clock input to pin 20 on bank 1 which had the consequence that I had to change the PLL primitive from SB_PLL40_PAD to SB_PLL40_CORE.
The same is true for the HX8K board where the clock is connected to J3 on bank 3.

After flashing the code to the boards the issues on both boards are identical:
- UART Communication works (frame boundary frame is send correctly; leds can be controlled)
- Initialization of the TS4231fails even if the "configured" output of the TS4231Configurator.v block changes to '1' (screenshot of the initialization captured with a logic analyzer is attached)
- If I attach an already initialized TS4231, which is putting out valid data on its D and E pins, frames are send over UART but no matching polynominal and thus no SID and Width is found in the print_frame.py .
- I also double checked the 48MHz and 24MHz Clocks (via Clock Divider and Output pin)

Any ideas how to hunt the bug?

Best Regards and thanks again for your awesome work!
Attachments
Init_of_the_TS4231.png
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: lighthouse-fpga Code on UPduino(UP5K) and HX8K Dev. Kit

Post by arnaud »

Hi,

Sorry for the late answer, things have been a bit busy here. Thanks for the kind words, Spinal was indeed a great step-up from verilog I was using on previous version of the lighthouse receiver.

For the chip initialization I would check the connection: the connection to the sensor is usually pretty sensitive and maybe there is noise on the line. You cannot trust the configured signal since I never implemented the readback of the configuration word.

As for the frames, maybe you could copy-paste some of the frames you receive so that I could check if they look good. One thing I can think about is the sensor spacing: to detect the polynomial the fpga will try to match 2 pulse that are assumed to come from the same basestation. The pulses are matched if they are close-enough in time, the current higher limit is 1024 6MHz tick: https://github.com/bitcraze/lighthouse- ... .scala#L82. This means that for the pulse identifier to work your sensors should be close-enough from each-other or you need to increase this limit.
flower
Beginner
Posts: 3
Joined: Fri Jan 15, 2021 8:37 am

Re: lighthouse-fpga Code on UPduino(UP5K) and HX8K Dev. Kit

Post by flower »

Hi, no worries I was also busy with other projects.

Maybe some more background before hand. The first time that I started working on this topic is almost two years ago.
After I could get the first useful position data with a system, based on an Intel MAX10 FPGA, I didn't really spend much more effort in this system. Although the system basically works, it has a few problems with reflections, longer distances to the base and a few other little things. When I started to fix some of these problems I came across your project and am excited about your approach. Even if it means that I will probably discard my current system and start working with yours. After all I at least have got some knowledge about the general steamVR system and maybe can add something to your project in the future.

Now to your reply

Chip initialization:
You are right, the connection is definitely very fragile, but in my case it should not be a problem because the sensors (tested several) initialize without problems on my original system. I have also compared the timing and except for not reading back the configuration, it was quite similar.

Not getting valid frames:
Okay, that explains the problem. I have not looked at the code in every detail, so I was not aware that at least 2 sensors are needed to be connected to receive valid frames. In my test, I only hooked up one at a time.

In the meantime I received two of your lighthouse FPGA boards and my colleague could already gain some experience with them. I should have some time next week to have a closer look at your code and then I will try again to run everything on the hx8k dev kit. :ugeek:


Thanks for your help, I will report as soon as I have further information. :)

Best Regards
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: lighthouse-fpga Code on UPduino(UP5K) and HX8K Dev. Kit

Post by arnaud »

Hi! Thanks for your answer.

Unfortunately I do not have much clue of what could happen with the configuration. I is possible that there is a bug in the current implementation that makes it extra-brittle.

For the 2 sensors, the reason for the requirement is to improve the range of measurements: when at ~6m, we only receive about 20 bits from the beam. However, to uniquely identify the LFSR that generated the bitstream we need twice the LFSR bit length. This is why using and correlating 2 consecutive pulses is used.
flower
Beginner
Posts: 3
Joined: Fri Jan 15, 2021 8:37 am

Re: lighthouse-fpga Code on UPduino(UP5K) and HX8K Dev. Kit

Post by flower »

Hi,

after I had some time the last days to have a closer look at the code I have now also checked the sensor initializing problems. I probably found a bug in the "ts4231Configurator.v" where the 15th bit of a 15 bit wide vector is accessed.

I have created a Pull Request: https://github.com/bitcraze/lighthouse-fpga/pull/13

Unfortunately I haven't had the chance to test the new code on your board yet. On the HX8K board however, the sensors initialize now without any problems.

Best Regards
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: lighthouse-fpga Code on UPduino(UP5K) and HX8K Dev. Kit

Post by arnaud »

That sounds great! I will test the PR and apply it if it works on the deck then. Thanks for the PR! :).
Post Reply