Skip to content

SDRAM data trapping #13

@matwey

Description

@matwey

I am working on pure-C implementation for OpenVizsla host software: https://github.com/matwey/libopenvizsla
I've faced the following issue with FPGA firmware last summer.
I have been not able to make FPGA reliable restart sniffed data transmission.

The issue itself is the following.
The protocol has two encapsulation levels.
The upper level is packets come from SDRAM buffering module.
The packets consists of 0x0D magic header, length byte, and the data.
On practice this packets are of the same length.
The nested data is a stream consisted of packets from captured data.
They are consisted of 0xA0 magic header, length and USB data.
This packets are not aligned with each other.
One 0x0D-packet may consisted many 0xA0-packets, and 0xA0-packet may be split between two consecutive 0x0D-packets.

When I stop capturing and streaming and start it again then the first data byte of the first 0x0D-packet is not 0xA0 which it should be.
This is an issue because there is no other reliable way to sync 0xA0-packet stream. We cannot just scan for first 0xA0 because 0xA0 byte may be consisted inside data itself (compare with SLIP protocol).

My stop sequence is the following:

  • write 0 to SDRAM_HOST_READ_GO (0xC28)

  • write 0 to SDRAM_SINK_GO (0xE11)

  • write 0 to CSTREAM_CFG (0x800)

My start sequence is the following (given I assured that the stream is stopped):

  • write 32-bit 0 to SDRAM_SINK_RING_BASE (0xE09)

  • write 32-bit 0x01000000 to SDRAM_SINK_RING_END (0xE0D)

  • write 32-bit 0 to SDRAM_HOST_READ_RING_BASE (0xC1C)

  • write 32-bit 0x01000000 to SDRAM_HOST_READ_RING_END (0xC20)

  • write 0 to SDRAM_SINK_PTR_READ (0xE00)

  • write 1 to CSTREAM_CFG (0x800)

  • write 1 to SDRAM_SINK_GO (0xE11)

  • write 1 to SDRAM_HOST_READ_GO (0xC28)

I've tried to add Reset for sdram_fifo in SDRAM_Sink and SDRAM_Host_Read to reset fifoes on SDRAM_SINK_GO/SDRAM_HOST_READ_GO switch but this didn't help.

The issue is still present in the latest firmware from new_migen branch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions