Author Topic: Lattice ICE40 instantiating RGB/IR pins as regular user IOs.  (Read 3642 times)

0 Members and 1 Guest are viewing this topic.

Offline da075Topic starter

  • Contributor
  • Posts: 10
  • Country: lb
Lattice ICE40 instantiating RGB/IR pins as regular user IOs.
« on: September 28, 2019, 12:35:07 pm »
Hello..

the ICE40 family has 3 dedicated pins for LED/IR connectivity (highlighted in the attached image), and they mention that these pins can be used as regular user IO pins. they even provide a verilog example (also attached) for using one of the pins as an output on page 34 (appendix b) of technical note TN1288, they also reference technical note 1253 but none of these clearly explain how to use these 3 special pins as regular IO in a vhdl project.

the code synthesizes correctly when adding the SB_IO_OD instantiation, however no matter which combination i try, i keep getting the very same error message during placement:
Error during constrained IO placement
E2792: Instance ipInertedIOPad_sadc0_4 incorrectly constrained at SB_IO_OD location
I2723: placment information file is dumped at : G:/work/icecube2/FPGAe/FPGA/FPGAImplmnt\sbt\outputs\placer\tmpTL.pcf
I2709: Tool unable to complete IOPlacement for the design
E2055: Error while doing placement of the design

and this is how the module is instantiated in my vhdl code
Code: [Select]
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

library sb_ice40_components_syn;
use sb_ice40_components_syn.components.all;

PIN39: SB_IO_OD     
generic map ( NEG_TRIGGER => '0',
                     PIN_TYPE    => "000001" ) -- << indicates an input pin.
port map ( DOUT1 => open,
                DOUT0 =>  adc0(4),                               
                CLOCKENABLE => open,
                LATCHINPUTVALUE => open,
                INPUTCLK => clock,                     
                DIN1 => open,
                DIN0 => open,
                OUTPUTENABLE => open,
                OUTPUTCLK => open,
                PACKAGEPIN  => sadc0(4));

it would be really appreciated if anyone has worked on this FPGA before and could give me a pointer in the right direction as to how to make these pins behave like regular input pins using VHDL.

« Last Edit: September 28, 2019, 12:55:40 pm by da075 »
 

Offline iMo

  • Super Contributor
  • ***
  • Posts: 5153
  • Country: bt
Re: Lattice ICE40 instantiating RGB/IR pins as regular user IOs.
« Reply #1 on: September 28, 2019, 01:51:13 pm »
Afaik there is a "rule" how the RGB pins are routed. Can't remember details, however..
Readers discretion is advised..
 
The following users thanked this post: da075

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15323
  • Country: fr
Re: Lattice ICE40 instantiating RGB/IR pins as regular user IOs.
« Reply #2 on: September 28, 2019, 01:54:47 pm »
Show us your top-level ports.
 
The following users thanked this post: da075

Offline da075Topic starter

  • Contributor
  • Posts: 10
  • Country: lb
Re: Lattice ICE40 instantiating RGB/IR pins as regular user IOs.
« Reply #3 on: September 28, 2019, 02:14:32 pm »
alright i think i have figured it out.

the sb_io_od port documentation in icecube2' technology library is clearer on how to setup the parameters, so in order for instance to use the pin as input, we need to do 3 things,

1- include the specific libraries.
2- instantiate the SB_IO_OD module
3- setup the proper parameters (can be figured out form the attached sb_io_od diagram from the technology library in icecube2 help)

it is quite a big file, i was using the signal straight from the input pin (PACKAGEPIN) elsewhere in my vhdl code, and that caused the placement hickup, once i changed that and replaced it by the corresponding signal from (DIN0), the placement proceeded correctly.

and thus, to use one of these 3 pins as input, the code to be inserted in the vhdl is the following:

Code: [Select]
-- first add the library references
library sb_ice40_components_syn;
use sb_ice40_components_syn.components.all;

--
-- .....
--

signal s_signal := std_logic := '0';

PIN39: SB_IO_OD     
    generic map ( NEG_TRIGGER => '0',
                  PIN_TYPE    => "000001" ) -- check the diagram for the input type you want and set the 2 LSBs accordingly.
    port map ( DOUT1 => open,  -- leave open           
               DOUT0 =>  open,  -- leave open   
               CLOCKENABLE => open,  -- leave open
               LATCHINPUTVALUE => '0', -- i do not want to latch the input.
               INPUTCLK => open,  -- leave open
               DIN1 => open,  -- leave open
               DIN0 => s_signal,  -- the internal signal to process and work with.
               OUTPUTENABLE => '0', -- disable the output.
               OUTPUTCLK => open,
               PACKAGEPIN  => TopLevelInputName);


but at any rate, this is not very documented online and this thread will maybe help someone in the future :)

thanks to the members who read and replied :)
« Last Edit: September 28, 2019, 02:22:05 pm by da075 »
 

Offline iMo

  • Super Contributor
  • ***
  • Posts: 5153
  • Country: bt
Readers discretion is advised..
 

Offline iMo

  • Super Contributor
  • ***
  • Posts: 5153
  • Country: bt
Re: Lattice ICE40 instantiating RGB/IR pins as regular user IOs.
« Reply #5 on: September 28, 2019, 02:25:04 pm »
BTW you may use the SPI programming pins as the user i/o too.
I read/write the bitstream flash off the fpga's userland that way (load/store the FORTH dictionary).
Readers discretion is advised..
 
The following users thanked this post: da075

Offline da075Topic starter

  • Contributor
  • Posts: 10
  • Country: lb
Re: Lattice ICE40 instantiating RGB/IR pins as regular user IOs.
« Reply #6 on: September 28, 2019, 02:41:00 pm »
IMO, true, i am using them as well, i however need all the IO pins i can get on this chip, so it is crucial that i let no pin go unused  :-+
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15323
  • Country: fr
Re: Lattice ICE40 instantiating RGB/IR pins as regular user IOs.
« Reply #7 on: September 28, 2019, 02:42:13 pm »
Well, those FPGAs have a very limited number of IO's, so you can hardly waste any.
 

Offline iMo

  • Super Contributor
  • ***
  • Posts: 5153
  • Country: bt
Re: Lattice ICE40 instantiating RGB/IR pins as regular user IOs.
« Reply #8 on: September 28, 2019, 06:18:20 pm »
Anyhow, in the above link is the verilog version from hackaday (not tested by myself yet)..
Readers discretion is advised..
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf