#define SPI2_PINCTRL_DEFAULT DT_PHANDLE_BY_IDX(DT_NODELABEL(spi2), pinctrl_0, 0)
this line doesnt compile. with this error:
why would it not work?
#define SPI2_PINCTRL_DEFAULT DT_PHANDLE_BY_IDX(DT_NODELABEL(spi2), pinctrl_0, 0)
this line doesnt compile. with this error:
why would it not work?
# Config Peripherals
CONFIG_GPIO=y
CONFIG_PM_DEVICE=y
####
# CPP
CONFIG_CPP=y
CONFIG_GLIBCXX_LIBCPP=y
CONFIG_NEWLIB_LIBC=y
CONFIG_STD_CPP17=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y # Enable software floating-point support
CONFIG_NEWLIB_LIBC_FLOAT_SCANF=y # Enable software floating-point support
####
# General Settings
CONFIG_FPU=y
CONFIG_RESET_ON_FATAL_ERROR=n # This is n to save reset reason. Do not set it as y.
CONFIG_ASSERT=y
CONFIG_RING_BUFFER=y
CONFIG_REBOOT=y
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
CONFIG_MAIN_STACK_SIZE=16384
####
# # Config LOGGER (Close while sleep test)
# CONFIG_LOG=y
# CONFIG_USE_SEGGER_RTT=y
# CONFIG_LOG_BACKEND_RTT=y
# CONFIG_LOG_BACKEND_UART=n
# CONFIG_LOG_PRINTK=y
# CONFIG_LOG_MODE_IMMEDIATE=n
# # to see DBG messages
# #CONFIG_LOG_DEFAULT_LEVEL=4
# ####
# Necessary options for low power consumption (Enabled while sleep test)
CONFIG_CONSOLE=n
CONFIG_UART_CONSOLE=n
# CONFIG_RTT_CONSOLE=n
CONFIG_USB_DEVICE_STACK=n
CONFIG_DEBUG_OPTIMIZATIONS=n
CONFIG_SERIAL=n
CONFIG_LOG=y
CONFIG_BT_DEBUG_LOG=n
####
CONFIG_LOG_BACKEND_UART=y # Use UART as the logging backend
CONFIG_LOG_DEFAULT_LEVEL=4
CONFIG_USE_SEGGER_RTT=y # Enable RTT support
CONFIG_RTT_CONSOLE=y # Use RTT for console output
# CONFIG_LOG=y # Enable the logging subsystem
CONFIG_LOG_BACKEND_RTT=y # Use RTT as the log backend
CONFIG_LOG_DEFAULT_LEVEL=1
CONFIG_SPI=y
Thanks
I can't find the device binding in Zephyr, have you added it to your project as a custom driver?
Btw from what I see the kx122-1037 is not recommended for designs and scheduled for obsolesce.
Edit; I would also suggest running spi2 on 8Mhz ref configuration
Regards
Runar
Thanks
I can't find the device binding in Zephyr, have you added it to your project as a custom driver?
Btw from what I see the kx122-1037 is not recommended for designs and scheduled for obsolesce.
Edit; I would also suggest running spi2 on 8Mhz ref configuration
Regards
Runar
Thamk you for your response!
1.yes
2.I know
3.I changed the frequency but it still doesn't work.
this is how I am trying to get the information in my code:
You should be using the kx122_spi instead of spi2. I also don't think you should name it SPI2_XX, from what I can see in the documentation and personal experience it's enough with just SPI_X.
I would expect some of the issue here is that you are trying to get the wrong spi instance, you are after the sensor and not the whole spi instance after all.
As it is a custom driver, how did you implement it?
Which version of NCS are you using? Node label is deprecated in newer versions
shlomots said:define SPI2_CS_PIN DT_PHA_BY_IDX(SPI2_NODE, cs_gpios, 0, pin)
Try with
SPI_CS_PIN DT_PHA_BY_INDEX(kx122_SPI, cs_gpios,0,pin)
Regards
Runar