- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everyone,
I am a newbie in FPGA-SoC field so forgive me if I ask a silly question.
So, after successfully programming first bare-metal application ( just blink the LEDs, not much ) on my Atlas-SoC board, I continue with my journey to investigate the HPS. I designed my HPS in Platform designer ( Qsys ) with some peripheral and one of them is I2C. Now, a little bit about my setting and how I understand things:
- My I2C0 is set as HPS I/O set 1
I set it like this because as I understand, with HPS I/O set 0, the I2C is configured on pin A19 and C18 ( by checking on board schematic and Intel Pinout file ). I do not want A19 and C18 because those pins are connected to Acceleration Interface which do not connect to any header or pin so that I can connect to external I2C slave device. Therefore, I go with HPS I/O set 1 because the I2C are now on pin C19 and B16 which are connected to LTC header and I can connect to them by jumpers.
As how I usually work with FPGA, after finishing my HPS and top level entity, I go to Pin planner and start assigning appropriate pins to my signals which here, C19 and B16 to SDA and SCL. However, in the Location tab where we type the pin name, it cannot find the pins C19 and B16 although it recommend to use those in the Fitter location. So, my first assumption is that " It is connected automatically". I leave it like that and go work on preloader, uboot and I2C application. However, when check in on oscilloscope, I do not see any signal coming from those SDA and SCL, which only hold high.
My question is that
- All the thing I have done so far is correct ?
- Is it wrong because I do not assign the pins properly ?
If not, then I need to check the C code but well, I want to make sure that all the necessary pins are assign properly.
Thanks in advance and all support is appreciated !
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Atlas SoC is using the Cyclone V SoC, you may want to refer here for the Mapping HPS IP Peripheral Signals to the FPGA Interface;
https://www.intel.com/content/dam/www/programmable/us/en/pdfs/literature/an/an706.pdf
It might help you answer your question.
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi el.ign,
Thanks for you reply. I see that we can route them to FPGA domain. But I also want to know if can we access directly HPS pins without going to FPGA? As I check the schematic of Atlas-SoC board, the I2C1 is connect to LTC header while I2C0 is connected to Accelerometer and no way to access I2C0 externally. That's why I try to access I2C1 by modifying it in Qsys and connect it with jumper on LTC header.
Can I do it as I said? Do I miss something or do I understand things in a wrong way? Or else, I will try to route it to FPGA at the end but I would like to if there is any others ways ( I'm learning ).
By the way, thank you for the answer Mr. el.ign. You have answered almost every questions I made and I really appreciate that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
You mention about the Intel pinout file, can you share to me which is it?
I'm pretty sure according to the Atlas-SoC user manual the HPS I2C0 for SCL and SDA are as C18 and A19 respectively. Have you tried to assign this before you changing them to C19 and B16?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Here is the pinout file I use:
https://www.intel.com/content/dam/altera-www/global/en_US/pdfs/literature/dp/cyclone-v/5csema4.pdf
Now I'm trying to use I2C1, this is in my Pin Planner:
According to the provided schematic from manufacturer, I use I2C1 because it is out to LTC header and from there I can connect it with jumper:
Those pins in circle are I2C1_SDA and I2C1_SCL on LTC header:
And for your question, I tried with C18 and A19 then I found out that they are connected to Accelerometer and I don't think I can connect to external slave device using jumper. Therefore, I changed to I2C1 because, yeah, it's connected to LTC header.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, after making above description, I think I realize that I made dumb things. I will try to figure out it first and comeback.
My apology.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi el.ign,
Yesterday, I found that I did not assign the pins properly. I went back to my tcl script and assigned those I2C1 pins. Here is what I have:
I have compiled it and programmed FPGA independently in Quartus. Then went to EDS-SoC to run the debug. However, still no result. I am not sure where I did something wrong.
Here is my application code:
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <socal/socal.h>
#include <time.h>
#include <math.h>
#include "alt_i2c.h"
#define mcp23008 (0x40)
int main(){
ALT_I2C_DEV_t I2C1;
ALT_I2C_MASTER_CONFIG_t *cfg;
//==============================i2c init ====================
status = alt_i2c_init(ALT_I2C_I2C1,&I2C0); // init the i2c
status = alt_i2c_enable(&I2C0);
status = alt_i2c_master_config_speed_get(&I2C0, cfg, &speed);
printf("INFO: Current I2C speed = %d Hz.\n", (int)speed);
set_cfg(&I2C0,cfg);// set up the config for master as desire
status = alt_i2c_master_config_speed_get(&I2C0, cfg, &speed);
printf("INFO: Current I2C speed = %d Hz.\n", (int)speed);
status = alt_i2c_op_mode_set(&I2C0,ALT_I2C_MODE_MASTER); // set it to be a master
status = alt_i2c_master_config_set(&I2C0,cfg); // pass the config to i2c instance
status = alt_i2c_sda_hold_time_set(&I2C0,3);
status = alt_i2c_master_target_set(&I2C0,mcp23008);
while (1)
{
status = alt_i2c_master_transmit(&I2C1,10,1,ALT_E_FALSE,ALT_E_TRUE);
}
return 0;
}
In the while loop, I just simply send some random data so I can see the transmission on I2C bus by oscilloscope.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everyone,
I found out the solution. It is quite dumb mistake but I explain it here for any self-learning student, who may face this mistake, can get over it.
First mistake: I did not assign the HPS pin properly. As a student who only worked with FPGA on Quartus, I just relied on Pin Planner without thinking. Yeah, I was dumb and I went through every tutorial without clear view. For any one who first try this, if you want to use any peripheral in HPS, you need to assign the pins with the TCL script ( you can find how to make it on internet, pretty straight forward and easy to learn ).
Second mistake: After changing the configuration, you need to generate and boot the preloader again to you board in order to configure the peripheral, SDRAM, ...
Third mistake: Well, it is quite personal mistake but after everything, check your slave address ! I used a wrong address ( screw me ).
That's all. I know, they are all beginner mistakes but they are pretty hard to notice if you are self-learning student on this field. I hope I can help anyone of you learn from my mistakes and keep on with the journey.
Cheers !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't think it is a dumb mistake, learning from any mistakes is also part of the learning process. :)
Wish I could assist you better. Keep learning my friend.
Best Regards.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page