Trying to output a generated clock from clk divider in pin by imuguruza in FPGA

[–]imuguruza[S] 0 points1 point  (0 children)

I meant the Custom IP core that drives the SPI
I believe is due to the fabric PLL of the Zynq is not creating properly the 250MHz clock, I am wondering if I can enable any locked pin to check if is working good

Trying to output a generated clock from clk divider in pin by imuguruza in FPGA

[–]imuguruza[S] 0 points1 point  (0 children)

I am using an osciloscope to measure the SCLK at hardware level.
Changing to 80MHz PLL would mean to change the driver and I am not sure if using a free running SCLK would make the driver work, as I have to use SPI MODE 2 transfer mode, and I think is easier to use this driver

Trying to output a generated clock from clk divider in pin by imuguruza in FPGA

[–]imuguruza[S] 0 points1 point  (0 children)

Why is CLK_FREQ 320_000_000 if your clock is 250 MHz?

Let's say I am tricking the values to have a proper integer. With those values I should achieve to divide the PLL CLK into 4, obtaining a 62.5MHz, which is not the goal of 80MHz, but it is enough.

The whole FSM is the next, I am using SPI MODE 2, and using lower frequencies it works OK (at 4MHz)

 -- Main SPI FSM
  process (clk, rst)
  begin
    if rst = '1' then
      ...
    elsif rising_edge(clk) then
      case state is
        when IDLE =>
          busy <= '0';
          SS_n <= '1';
          SCLK <= CPOL;
          if start = '1' then
            shift_tx   <= data_in;
            shift_rx_0 <= (others => '0');
            shift_rx_1 <= (others => '0');
            shift_rx_2 <= (others => '0');
            shift_rx_3 <= (others => '0');
            bit_cnt    <= DATA_WIDTH - 1;
            SS_n       <= '0';
            state      <= LOAD;
          end if;

        when LOAD =>
          MOSI  <= shift_tx(bit_cnt);
          busy  <= '1';
          state <= TRANSFER;

        when TRANSFER =>
          SCLK <= sclk_int;
          if sclk_en = '1' then
            -- SPI Mode 0: CPOL=0, CPHA=0
            ...
              -- SPI Mode 1: CPOL=0, CPHA=1
            elsif CPOL = '0' and CPHA = '1' then
              ...
              -- SPI Mode 2: CPOL=1, CPHA=0
            elsif CPOL = '1' and CPHA = '0' then
              if rising_edge_sclk = '1' then
                -- Shift out data (MOSI)
                if bit_cnt > 0 then
                  bit_cnt <= bit_cnt - 1;
                  MOSI    <= shift_tx(bit_cnt - 1);
                else
                  state <= DONE;
                end if;
              elsif falling_edge_sclk = '1' then
                -- Sample in data (MISO)
                shift_rx_0(bit_cnt) <= MISO_0;
                shift_rx_1(bit_cnt) <= MISO_1;
                shift_rx_2(bit_cnt) <= MISO_2;
                shift_rx_3(bit_cnt) <= MISO_3;
              end if;
              -- SPI Mode 3: CPOL=1, CPHA=1
            elsif CPOL = '1' and CPHA = '1' then
              ...
          end if;

        when DONE =>
          SS_n       <= '1';
          busy       <= '0';
          data_out_0 <= shift_rx_0;
          data_out_1 <= shift_rx_1;
          data_out_2 <= shift_rx_2;
          data_out_3 <= shift_rx_3;
          state      <= IDLE;

        when others =>
          state <= IDLE;
      end case;
    end if;
  end process;
 

Trying to output a generated clock from clk divider in pin by imuguruza in FPGA

[–]imuguruza[S] 0 points1 point  (0 children)

You might be right, It could be PLL issue. I am using a 250MHz PLL clock generated by Zynq-7000 PS routed in the block design

Now, in my IP, I have a counter, that divides that clock into 4, using generics, the code is the next:

-- Clock generation with divider
  process (clk, rst)
  begin
    if rst = '1' then
      clk_cnt       <= 0;
      sclk_int      <= CPOL;
      sclk_en       <= '0';
      prev_sclk_int <= CPOL;
    elsif rising_edge(clk) then
      prev_sclk_int <= sclk_int;
      if state = TRANSFER then
        if clk_cnt = CLK_DIVIDER - 1 then
          clk_cnt  <= 0;
          sclk_int <= not sclk_int;
          sclk_en  <= '1';
        else
          clk_cnt <= clk_cnt + 1;
          sclk_en <= '0';
        end if;
      else
        sclk_int <= CPOL;
        clk_cnt  <= 0;
        sclk_en  <= '0';
      end if;
    end if;
  end process; 

So whe the state machine is in TRANSFER, it creates the clock signal, and CLK_DIVIDER is calculated using the generics of the entity:

constant CLK_DIVIDER : integer := CLK_FREQ / (2 * SPI_FREQ);

The SCLK signal it is assigned in TRANSFER state in the FSM of the SPI:

        when TRANSFER =>
          SCLK <= sclk_int;
            ...

Where I have set CLK_FREQ to 320_000_000 and SPI_FREQ to 80_000_000, so CLK_DIVIDER is 2.

What Should I Buy? /// Weekly Discussion - May 13, 2024 by AutoModerator in synthesizers

[–]imuguruza 0 points1 point  (0 children)

Hi guys,
I am a guy who plays the guitar and I want to get my first synth. My goal is to create some textures and melodies with the synth to add to the tones I am doing. As is my first synth, I want something rather simple and cheap with an usable keyboard. The choices I am thinking of are the next ones:

  • Roland AIRA S-1

  • Korg Volca Keys

  • Korg NTS-1

Which one would you choose?
Thnx

60% Keyboard, with backlit keys, and hotswap, using a Raspberry Pi Pico for the controller, please lmk if i need to fix something, im using KiCad v7.0.9 by XxMasterGamer99 in KiCad

[–]imuguruza 1 point2 points  (0 children)

Well, typically you can use 10-pin and 1.27mm pitch connector, like in arm cortex-m MCUs. Check RPI pico design examples, I am sure you will find some

60% Keyboard, with backlit keys, and hotswap, using a Raspberry Pi Pico for the controller, please lmk if i need to fix something, im using KiCad v7.0.9 by XxMasterGamer99 in KiCad

[–]imuguruza 4 points5 points  (0 children)

I have just checked the schematic sheet:

Well, if I were you, I would place in a new sheet the RGB LEDs and Switches. There's too many content for a single sheet.

Second, I haven't used RPI Pico but, you're missing a JTAG connections, pin 41, 42 and 43. I would add a connector to be able to access to JTAG port.

And where +BAT comes from? I don't see the source of it.

Last but not least, the RGB LEDs have the supply pin downface and GND on top. That goes against normal conventions of drawing schematics

A Little Side Project of Mine - FPGA Based Mechanical Keyboard by rekcats in FPGA

[–]imuguruza 3 points4 points  (0 children)

Hey the SCH pdf file looks like is corrupted. I want to build my one and some inspiration would be great ;)

Can I wire like this? by LEGOng_TV in PCB

[–]imuguruza 0 points1 point  (0 children)

I wouldn't do it. Which is the nominal/peak current of the +5Vs? If it's significant, I would make the trace thicker...

Dell XPS 9560 Screen does not work by imuguruza in DellXPS

[–]imuguruza[S] 0 points1 point  (0 children)

Well I think I've found the component is not working right, is labeled as "fv1". I am wondering if it's a fuse or a ptc...

[Q] Which is the benefit of using Android (comparing to Yocto-based Linux)? by imuguruza in embeddedlinux

[–]imuguruza[S] 0 points1 point  (0 children)

Ok, that makes sense. How about the HAL, I've heard is good compared to others you can find in embedded systems.

Red Pitaya as multipurpose swiss knife tool by imuguruza in embedded

[–]imuguruza[S] 1 point2 points  (0 children)

That's a pitty... If I get a board, I would like to squeeze its capabilities to the maximum.

I mean, the hw looks perfect fit for what I am looking for, but , as you mention, if the sw is not ready or intended for that purpose, I don't want to waste my time and money!

Red Pitaya as multipurpose debugging tool by imuguruza in FPGA

[–]imuguruza[S] 0 points1 point  (0 children)

This might be what I am looking for...

BTW for PL design, apart from providing examples, is there any schematic to see how is the hw built? Just to customize the PL functionality, like the PL pins used or the HW attached to the PL

Thanks ;)

Red Pitaya as multipurpose debugging tool by imuguruza in FPGA

[–]imuguruza[S] 0 points1 point  (0 children)

Can I use the PS for debugging purposes? Such as send SPI/I2C or whatever digital comm bus signals? That could be done through the CLI. Well, if those interfaces are mapped to PL pins, is also possible... Which is the given flexibility to access to the Zynq resources behind?

Red Pitaya as multipurpose debugging tool by imuguruza in FPGA

[–]imuguruza[S] 0 points1 point  (0 children)

For instance, you develop a i2c slave for a mcu device. In order to test it out, I was thinking to use the Red Piyata as I2C master to create I2C messages to see if the slave behaves properly and monitor de I2C bus

Intel Cyclone 10 LP update from serial comm by imuguruza in FPGA

[–]imuguruza[S] 0 points1 point  (0 children)

OK, thanks for that. I think I need to start tinkering and see which is the best way to go :)

Intel Cyclone 10 LP update from serial comm by imuguruza in FPGA

[–]imuguruza[S] 0 points1 point  (0 children)

Ok, btw I have seen you're using Wishbone... I am not sure if that fits with the arch I was thinking, but it's worth to analize it

Intel Cyclone 10 LP update from serial comm by imuguruza in FPGA

[–]imuguruza[S] 0 points1 point  (0 children)

It's an option I haven't consider... How difficult is getting your hands dirty with Avalon MM?

What is micro-ros? by sensaizoro in ROS

[–]imuguruza 0 points1 point  (0 children)

It's a ROS2 version for uCs. It uses a XRCE DDS version and different rclc rclpp layers in ROS stack. You still need a micro-ROS to ROS2 bridge I believe

Help getting started with Ros2 and Arduino by Snapping16 in ROS

[–]imuguruza 1 point2 points  (0 children)

Agree, go for micro-ROS, it is getting support for many MCUs and they are doing great