OpenCores
Issue List
Could not see the signals yet #6
Open vakkascelik opened this issue about 11 years ago
vakkascelik commented about 11 years ago

Dear Joris,

First of all, thank you very much for such an useful core and rtems drivers.

We have some problems, you may give idea to solve this problem. We have Xilinx vc707 board. Since it has 200 mhz system clock, we didn't use DCM to generate 200 mhz clock for spacewire. Morover, we have not used spacewire signals as differential but as ttl. Let me print down our spacewirelight related parts of our leon3mp design, so you can understand more clear.

in constraint file (.xdc): set_property PACKAGE_PIN F35 get_ports { spw_di } set_property IOSTANDARD LVCMOS18 get_ports { spw_di } set_property PACKAGE_PIN G42 get_ports { spw_do } set_property IOSTANDARD LVCMOS18 get_ports { spw_do } set_property PACKAGE_PIN K40 get_ports { spw_si } set_property IOSTANDARD LVCMOS18 get_ports { spw_si } set_property PACKAGE_PIN G41 get_ports { spw_so } set_property IOSTANDARD LVCMOS18 get_ports { spw_so }

in leon3mp.vhd:

... spw_clk : in std_ulogic; -- spw_rxdp : in std_logic_vector(0 to 2); -- spw_rxdn : in std_logic_vector(0 to 2); -- spw_rxsp : in std_logic_vector(0 to 2); -- spw_rxsn : in std_logic_vector(0 to 2); -- spw_txdp : out std_logic_vector(0 to 2); -- spw_txdn : out std_logic_vector(0 to 2); -- spw_txsp : out std_logic_vector(0 to 2); -- spw_txsn : out std_logic_vector(0 to 2)

spw_di	  		: in  std_logic;
spw_si	  		: in  std_logic;
spw_do         : out std_logic;
spw_so         : out std_logic

....

signal spw_clkl : std_ulogic; signal spw_tick_in: std_logic; --signal spw_di: std_logic; --signal spw_si: std_logic; --signal spw_do: std_logic; --signal spw_so: std_logic;

....

spw0: spwamba generic map ( tech => memtech, hindex => 12,--CFG_NCPU+CFG_AHB_UART+CFG_GRETH+CFG_AHB_JTAG+CFG_SVGA_ENABLE, pindex => 12, paddr => 12, pirq => 12, sysfreq => real(CPU_FREQ) * 1000.0, txclkfreq => 200.0e6, rximpl => impl_fast, rxchunk => 4, tximpl => impl_fast, timecodegen => true, rxfifosize => 8, txfifosize => 8, desctablesize => 10, maxburst => 3 ) port map ( clk => clkm, rxclk => lclk, txclk => lclk, rstn => rstn, apbi => apbi, apbo => apbo(12), ahbi => ahbmi, ahbo => ahbmo(12),--CFG_NCPU+CFG_AHB_UART+CFG_GRETH+CFG_AHB_JTAG+CFG_SVGA_ENABLE), tick_in => spw_tick_in, tick_out => open, spw_di => spw_di, spw_si => spw_si, spw_do => spw_do, spw_so => spw_so );

-- spw_rxd_pad: inpad_ds -- generic map (padtech, lvds, x25v) -- port map (spw_rxdp(0), spw_rxdn(0), spw_di); -- spw_rxs_pad: inpad_ds -- generic map (padtech, lvds, x25v) -- port map (spw_rxsp(0), spw_rxsn(0), spw_si); -- spw_txd_pad: outpad_ds -- generic map (padtech, lvds, x25v) -- port map (spw_txdp(0), spw_txdn(0), spw_do, '0'); -- spw_txs_pad: outpad_ds -- generic map (padtech, lvds, x25v) -- port map (spw_txsp(0), spw_txsn(0), spw_so, '0');

-- Use 2nd GPTIMER unit to generate external tick_in signal.

spw_tick_in <= gpto.tick(2) when CFG_GPT_ENABLE /= 0 else '0';

...

Then, we have used your spacewirelight drivers and then spwltest.c file as a reference to send and receive spacewire packets. We couldn't receive spacewire packets yet, but we firstly want to see if we can send spacewire packets. We haven't seen them yet. The code doesn't give any error messages. It seems as if it is really sending. Here how we have initialized spacewirelight in rtems side:

rtems_status_code ret; int i; / Create TX data pool. / for (i = 0; i < MAX_BLOCK_SIZE; i++) { int v = ((i & 1) << 7) | ((i & 2) << 5) | ((i & 4) << 3) | ((i & 8) << 1) | ((i & 16) >> 1) | ((i & 32) >> 3) | ((i & 64) >> 5) | ((i & 128) >> 7); v += (i >> 8); txpooli = v; }

spw_index = 0;
printf("Opening driver for device index %u\n"
       "  options: rxbufs=%u, txbufs=%u, rxbufsize=%u, txbufsize=%u\n",
       spw_index,
       spw_opt.rxbufs, spw_opt.txbufs,
       spw_opt.rxbufsize, spw_opt.txbufsize);

ret = spwl_open(&spwh, spw_index, &spw_opt);
if (ret != RTEMS_SUCCESSFUL)
{
	printf("ERROR: SpacewireLight Could not Be Opened\n");
    if (ret == RTEMS_INVALID_NUMBER)
        printf("ERROR: SpaceWire Light core not found\n");
}

do_set_link_speed(200);

spw_mode = SPWL_LINKMODE_START;
ret = spwl_set_linkmode(spwh, spw_mode);
if (ret != RTEMS_SUCCESSFUL)
	printf("ERROR: Link mode not set\n");

printf("SpaceWire Driver Initialized\n"); }

void sendTestData(void) { rtems_status_code ret; unsigned int f; size_t p; p=100;

f = SPWL_EOP;
txbuf_desc.data = txpool;
txbuf_desc.nbytes = 100;
txbuf_desc.eop = SPWL_EOP;//0;
ret = spwl_send(spwh, &txbuf_desc, p, &p, f | SPWL_WAIT);

// ret = spwl_send_txbuf(spwh, &txbuf_desc, SPWL_WAIT); if (ret != RTEMS_SUCCESSFUL) printf("spwl_send_txbuf error!!!\n"); else printf("Sending Test Data\n");

}

I hope these may help you to see the problem. I can give additional information.

Thank you very much,

Vakkas

jorisvr commented about 11 years ago

Hi Vakkas,

You are lucky to have a Virtex-7 board.

I'm not familiar with XDC files; I always use UCF files to constrain pins. But let's assume your pin constraints are correct. Everything else about your design seems to make sense to me.

Your programs prints "SpaceWire driver initialized" right?

I have not seen your function do_set_link_speed(). Note that you must not set the speed scaler to 200; that would be 200 MHz / 200 = 1 Mbit/s which is an invalid TX rate. Better leave the link speed at default if you are not sure.

Are the spacewire signals unconnected, or looped back or connected to another Spacewire node?

Are you looking at the signals with an oscilloscope? Is it fast enough? A spacewire node is quiet most of the time during the first phase of link setup. So you may need some triggering on the scope to catch the signals.

vakkascelik commented about 11 years ago

Hi Joris,

Thank you very much for your response.

I have left the link speed at default. My program prints "Spacewire driver initialized".

Spacewire signals are not looped back. I generally look at the signals with an oscilloscope when the signals are not connected, but sometimes I connect the signals to Star-Dundee Spacewire-USB Brick. I can see the signals on the scope when I send the spacewire packet from PC by using Star-Dundee Spacewire-USB Brick.

Program also cannot receive the signals sent by Spacewire-USB Brick.

Morover, I use the Rtems of Gaisler.

I hope these information will be helpful.

Thanks a lot.

Vakkas

vakkascelik commented about 11 years ago

Hi Joris,

Thank you very much for your response.

I have left the link speed at default. My program prints "Spacewire driver initialized".

Spacewire signals are not looped back. I generally look at the signals with an oscilloscope when the signals are not connected, but sometimes I connect the signals to Star-Dundee Spacewire-USB Brick. I can see the signals on the scope when I send the spacewire packet from PC by using Star-Dundee Spacewire-USB Brick.

Program also cannot receive the signals sent by Spacewire-USB Brick.

Morover, I use the Rtems of Gaisler.

I hope these information will be helpful.

Thanks a lot.

Vakkas

vakkascelik commented about 11 years ago

Hi Joris,

Thank you very much for your response.

I have left the link speed at default. My program prints "Spacewire driver initialized".

Spacewire signals are not looped back. I generally look at the signals with an oscilloscope when the signals are not connected, but sometimes I connect the signals to Star-Dundee Spacewire-USB Brick. I can see the signals on the scope when I send the spacewire packet from PC by using Star-Dundee Spacewire-USB Brick.

Program also cannot receive the signals sent by Spacewire-USB Brick.

Morover, I use the Rtems of Gaisler.

I hope these information will be helpful.

Thanks a lot.

Vakkas

jorisvr commented about 11 years ago

It is of course impossible to connect TTL signals to a real SpaceWire device. SpaceWire uses LVDS, not LVTTL.

What do you see exactly on the scope? It is difficult to see "packets" on a spacewire line because both sides are constantly transmitting bits when the link is up, even when no packets are sent.

My Spacewire driver for RTEMS does not work with Gaisler-RTEMS. You could not even compile it.

If you have problems with your own RTEMS program, you could instead try the precompiled test program spwltest.dsu.

vakkascelik commented about 11 years ago

Hi Joris,

I have tried "spwltest.dsu", and the program printed out the following:

----------apwamba_test------------ Found SPWAMBA core at 0x80000900, irq=9 CHECK FAILED: line 131, reg control, gor 0x0a000004, expected 0x0a000000

IU in error mode <tt = 0x02, illegal instruction> 0x400011bc: 00000000 unimp <fail+28>

Does this give idea about the problem.

Thanks a lot

Vakkas

jorisvr commented about 11 years ago

spwltest.dsu does not give such messages.

You probably used spwamba_test.dsu. It is better to run it immediately after a reset of the LEON3 (not run spwamba_test.dsu after trying some other Spacewire software).

vakkascelik commented about 11 years ago

Hi Joris,

I think there isn't any precompiled spwltest.dsu in spacewirelight folder. Could you provide it to me?

My email address is vkscelik@gmail.com

Thank you very much

Vakkas

vakkascelik commented about 11 years ago

Hi Joris,

Thank you very much for the executable image of the test program. I have been testing it; however, I haven't seen the signals on the scope yet.

I change the link speed to 10 Mbit/s. Then, I Re-initialize the driver. Then, I send packets by any options (Copy API/Queue API, blocking calls/event loop). Is what mode and status are important. I make mode=start by 'Set link mode' operation before sending packets.

Our scope is a 200MHz Agilent scope. Signals are not connected. As I mentioned before, strobe and data out signals are not differential. We will convert these signals to lvds later, before connecting to another spacewire module.

I feel we are very close to the solution, but I don'2t know what to test now to understand the problem.

Thank you very much.

vakkascelik commented about 11 years ago

Hi Joris,

Fortunately, We have ound the problem. We had assigned invalid clock signals to rxclk and txclk. Now, we have assigned the same clock with system clock.

port map ( clk => clkm, rxclk => clkm, txclk => clkm, ...

Now, we can see the data and probe signals immediately after when we call the spwl_open function and then spwl_set_linkmode(SPWL_LINKMODE_START) function.

Is this normal? Shouldn't we see these signals when we call the send functions?

Thank you very much

Vakkas

jorisvr commented about 11 years ago

Yes it is normal. The signals on a Spacewire link are always switching, even when no packets are sent.

It may be useful to look at the Spacewire specification. Implementing Spacewire in an FPGA is a big step if you don't know the first thing about the protocol.

Joris.

vakkascelik commented about 11 years ago

Hi Joris,

Thank you for the feedback.

Best Regards,


Assignee
No one
Labels
Request