Forum Discussion
EBERLAZARE_I_Intel
Regular Contributor
2 years agoHi,
Could you share your design that faced this error? That would be helpful.
andy25
Occasional Contributor
2 years agoNot easily. But I can tell you how to recreate it pretty easy.
1) create a platform designer with a NiosV and an i2c master. Just enough to generate the .socpinfo file, you dont need anything in quartus.
2) create a default hal bsp, make sure altera_avalon_i2c is being included.
3) create an app, add this to your CMakeLists.txt:
target_compile_options(app.elf PRIVATE -fno-exceptions -fno-common -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -D_FORTIFY_SOURCE=2 -fstack-protector -Wall -Wextra -Wshadow -Wdouble-promotion -Wnon-virtual-dtor -Wcast-align -Wunused -Wundef -Woverloaded-virtual -Wpedantic -Wconversion # warn on type conversions that may lose data -Wsign-conversion -Wnull-dereference -Wformat=2 -Wmisleading-indentation -Wduplicated-cond -Wduplicated-branches -Wlogical-op )
4) In your main add something like:
ALT_AVALON_I2C_DEV_t *i2c_dev = alt_avalon_i2c_open(IPMB_0_I2C_MASTER_NAME); if (i2c_dev == nullptr) { uart.println("Error: Cannot find /dev/i2c_0"); return; } // set remote address alt_avalon_i2c_master_target_set(i2c_dev, addr); ALT_AVALON_I2C_STATUS_CODE status = alt_avalon_i2c_master_tx( i2c_dev, txbuffer, numValues, ALT_AVALON_I2C_NO_INTERRUPTS ); // this gives warnings if (status == ALT_AVALON_I2C_SUCCESS) { uart.println("send success (staus = %d)", status); } // this errors switch(status) { case ALT_AVALON_I2C_SUCCESS: uart.println("send success (staus = %d)", status); break; }