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-S...
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.
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?
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.
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.