Author Topic: generate SPI in verilog  (Read 2427 times)

0 Members and 1 Guest are viewing this topic.

Offline ali_asadzadehTopic starter

  • Super Contributor
  • ***
  • Posts: 1904
  • Country: ca
generate SPI in verilog
« on: June 01, 2021, 09:04:59 am »
Hi,
I have a 16Bit SPI master and I need to generate 9 of them,

Here is my code

Code: [Select]
wire wStart , wAdcDv;
wire [15:0] wAdcData [8:0];

// The for-loop creates 9 ADC statements
genvar i;
generate
for (i=0; i < 9; i = i + 1) begin
SPI_Master SPI(
.i_Clk(i_Clk50MHz),
.i_Rst(1'b0),
.i_start(wStart),
.o_RXData(wAdcData[i]),
.o_DV(wAdcDv),
.o_Busy(),
//physical pins
.i_MISO_pin(i_AdcSdo[i]),
.o_SCLK_pin(o_AdcSck[i])
);
end
endgenerate

ISE would complain about
Quote
Signal o_AdcSck[8] in unit top is connected to following multiple drivers
What am I doing wrong?
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline dtodorov

  • Contributor
  • Posts: 46
  • Country: bg
Re: generate SPI in verilog
« Reply #1 on: June 01, 2021, 09:09:51 am »
Not sure if it can help, but maybe you can try to explicitly define
Code: [Select]
wire [8:0] o_AdcSck;

 
The following users thanked this post: ali_asadzadeh

Online BrianHG

  • Super Contributor
  • ***
  • Posts: 7732
  • Country: ca
Re: generate SPI in verilog
« Reply #2 on: June 01, 2021, 09:34:57 am »

ISE would complain about
Quote
Signal o_AdcSck[8] in unit top is connected to following multiple drivers
What am I doing wrong?
Usually this means that somewhere else in your code, you have set or assigned 'AdcSck[8] <=' to something.  You cannot set 2 different values to the same IO pin or logic cell.
 

Offline ali_asadzadehTopic starter

  • Super Contributor
  • ***
  • Posts: 1904
  • Country: ca
Re: generate SPI in verilog
« Reply #3 on: June 02, 2021, 05:55:12 am »
Quote
Usually this means that somewhere else in your code, you have set or assigned 'AdcSck[8] <=' to something.  You cannot set 2 different values to the same IO pin or logic cell.
Thanks, Stupid me, I have some typo in somewhere else :palm:
« Last Edit: June 02, 2021, 06:00:17 am by ali_asadzadeh »
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Online BrianHG

  • Super Contributor
  • ***
  • Posts: 7732
  • Country: ca
Re: generate SPI in verilog
« Reply #4 on: June 02, 2021, 08:37:46 am »
Quote
Usually this means that somewhere else in your code, you have set or assigned 'AdcSck[8] <=' to something.  You cannot set 2 different values to the same IO pin or logic cell.
Thanks, Stupid me, I have some typo in somewhere else :palm:
Been there, done that who knows how many times.
Also, it took a few times seeing that same error message in Quartus before I knew what to look for every time it shows up.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf