On Mon, Feb 24, 2020 at 11:30 AM Brian Padalino <bpadalino_at_gmail.com> wrote:
> On Mon, Feb 24, 2020 at 11:20 AM Davis Hoover <dhoover_at_geontech.com>
> wrote:
>
>> I'm guessing this is an issue with how the framework maps the HDL
>> slave's memory as made available to the RCC proxy. I know there are
>> some differences in the C++ classes for management of simulator vs
>> FPGAs, and it seems I need to exercise the latter to recreate the
>> problem.
>>
>> It may be helpful to look at your application XML.
>>
>
I've finally figured out and solved this issue, and it had nothing to do
with the mapping in the HDL. It was a very silly RCC bug that took me ages
to find.
The problem is very straight forward and involves a few files:
https://gitlab.com/opencpi/opencpi/-/blob/d02048431c71ce74d8b25eb3afec39ba6d7fdd23/projects/assets/hdl/devices/ad9361_config_proxy.rcc/ad9361_config_proxy.cc#L849
https://gitlab.com/opencpi/opencpi/-/blob/d02048431c71ce74d8b25eb3afec39ba6d7fdd23/projects/assets/hdl/devices/ad9361_config_proxy.rcc/ad9361_platform.cc#L39
https://gitlab.com/opencpi/opencpi/-/blob/d02048431c71ce74d8b25eb3afec39ba6d7fdd23/projects/assets/prerequisites/ad9361/ad9361.patch#L43
- The ad9361_config_proxy.cc calls spi_init() on line 849 which is in
ad9361_platform.cc
- spi_init() assigns the pointer to an instance variable
of OCPI::RCC::RCCUserSlave* called slave
- slave is used whenever spi_write_then_read() is used, and the struct
spi_device* is not used
- Someone planned to use it, since struct spi_device has a device type
which has a void* called slave in it
For my case, each time the initialization of the ad9361_config_proxy was
happening (twice - once for each AFE), spi_init() was being called and kept
re-assigning the slave pointer, even though each ad9361_config_proxy is
separate and have different slaves.
My modification was to assign ad9361_rf_phy->spi->dev.slave after this line:
https://gitlab.com/opencpi/opencpi/-/blob/d02048431c71ce74d8b25eb3afec39ba6d7fdd23/projects/assets/hdl/devices/ad9361_config_proxy.rcc/ad9361_config_proxy.cc#L346
... and modify the spi_write_then_read() function to:
- check if spi is null, if so - use slave as assigned from spi_init()
- otherwise, use slave as assigned to spi->dev.slave
This allows the AD9361 initialization sequence to go through without
needing to have the spi device populated, and assign it to the appropriate
ad9361_phy once it has been initialized. It appears to have worked for me
since I can now read the two different temperatures of my devices, and
ping-pong the frequencies back with other devices.
I don't know if this is the best solution so I am not posting patches, but
for anyone who is working with multiple AD9361 devices on the same
platform, this will definitely bite you.
Brian
>
Received on Thu Mar 26 2020 - 21:16:17 CDT