SPI imx8 QM MEK

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SPI imx8 QM MEK

1,229 Views
builinhhh
Contributor II

Hi,
I want to use SPI on board imx8 QM MEK with Android 13.
Because the board does not have spare pins for SPI, I want to utilize flash to use FlexSPI. I have some questions.
1. if I want connect STM32 with board imx8QM via SPI. Does board imx8 have spare pins of SPI?
2. If the board does not have spare pins of SPI. Can I read data from Flash via FlexSPI? If yes, how can I do that?

0 Kudos
12 Replies

1,206 Views
Sanket_Parekh
NXP TechSupport
NXP TechSupport

Hi @builinhhh,

I hope you are doing well.
 
The i.MX8 can boot out of the following boot devices:
- eMMC/SD card
- FlexSPI Flash
- NAND
- Serial Download Protocol (USB)
One can find flashing through FlexSPI in the following reference manual: i.MX_Digital_Cockpit_Hardware_Partitioning_Enablement_for_i.MX_8QuadMax
 
Thanks & Regards,
Sanket Parekh
0 Kudos

1,185 Views
builinhhh
Contributor II

hi @Sanket_Parekh 

thanks for your supports. But i can't access the second link because permission denied. 
How can I access it or can you send me an alternative link?
0 Kudos

1,175 Views
Sanket_Parekh
NXP TechSupport
NXP TechSupport

Hi @builinhhh 

I hope you are doing well.

Yes, the second link is for the selected NXP users only.
This is the alternative for that: Chapter 8 Run a flash target demo.
It is followed by the M4 SDK release doc "Getting Started with MCUXpresso SDK for i.MX 8QuadXPlus".
 
Thanks & Regards,
Sanketr Parekh
0 Kudos

1,172 Views
builinhhh
Contributor II

Hi @Sanket_Parekh ,

Can I enable Flex SPI on Linux OS? It means I want to use simultaneous eMMC and FLASH. Read Data in FLASH and send data to User-space. Is it possible?

0 Kudos

1,162 Views
Sanket_Parekh
NXP TechSupport
NXP TechSupport

Hi @builinhhh,

I hope you are doing well.
 

CONFIG_SPI_NXP_FLEXSPI is to enable the Flexspi module.
One can find the details of steps mentioning the Flashing flexspi.
One can find flashing through FlexSPI in the following reference manual: i.MX_Digital_Cockpit_Hardware_Partitioning_Enablement_for_i.MX_8QuadMax
One can find the following reference for flexspi, which one may ignore, if not found useful: 
Also, refer to Chapter 8 Run a flash target demo. It is followed by the M4 SDK release doc "Getting Started with MCUXpresso SDK for i.MX 8QuadXPlus".
 
Thanks and Regards,
Sanket Parekh
0 Kudos

1,154 Views
builinhhh
Contributor II

Hi @Sanket_Parekh , thank you very much for your very enthusiastic supports.

I run "make menuconfig"  and Enable Flex SPI config. Then "make"
But it has some errors.
As a matter of fact, I really hasn't known How to build the project. After I turn a few code, I usually run "imx.make.sh" to rebuild all. It's really really complicated. 
Can you teach me how to make?

and this code bellow is error I met when I make after make menuconfig. 

drivers/net/phy/mscc/mscc_main.c: In function ‘vsc8514_validate_inband_aneg’:
drivers/net/phy/mscc/mscc_main.c:2195:9: error: ‘PHY_INBAND_ANEG_OFF’ undeclared (first use in this function)
2195 | return PHY_INBAND_ANEG_OFF | PHY_INBAND_ANEG_ON;
| ^~~~~~~~~~~~~~~~~~~
drivers/net/phy/mscc/mscc_main.c:2195:9: note: each undeclared identifier is reported only once for each function it appears in
drivers/net/phy/mscc/mscc_main.c:2195:31: error: ‘PHY_INBAND_ANEG_ON’ undeclared (first use in this function)
2195 | return PHY_INBAND_ANEG_OFF | PHY_INBAND_ANEG_ON;
| ^~~~~~~~~~~~~~~~~~
drivers/net/phy/mscc/mscc_main.c: At top level:
drivers/net/phy/mscc/mscc_main.c:2416:3: error: ‘struct phy_driver’ has no member named ‘validate_inband_aneg’
2416 | .validate_inband_aneg = vsc8514_validate_inband_aneg,
| ^~~~~~~~~~~~~~~~~~~~
drivers/net/phy/mscc/mscc_main.c:2416:26: error: initialization of ‘int (*)(struct phy_device *, struct ethtool_tunable *, void *)’ from incompatible pointer type ‘int (*)(struct phy_device *, phy_interface_t)’ {aka ‘int (*)(struct phy_device *, enum <anonymous>)’} [-Werror=incompatible-pointer-types]
2416 | .validate_inband_aneg = vsc8514_validate_inband_aneg,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/phy/mscc/mscc_main.c:2416:26: note: (near initialization for ‘vsc85xx_driver[2].get_tunable’)
drivers/net/phy/mscc/mscc_main.c:2417:3: error: ‘struct phy_driver’ has no member named ‘config_inband_aneg’
2417 | .config_inband_aneg = vsc8514_config_inband_aneg,
| ^~~~~~~~~~~~~~~~~~
drivers/net/phy/mscc/mscc_main.c:2417:24: error: initialization of ‘int (*)(struct phy_device *, struct ethtool_tunable *, const void *)’ from incompatible pointer type ‘int (*)(struct phy_device *, bool)’ {aka ‘int (*)(struct phy_device *, _Bool)’} [-Werror=incompatible-pointer-types]
2417 | .config_inband_aneg = vsc8514_config_inband_aneg,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/phy/mscc/mscc_main.c:2417:24: note: (near initialization for ‘vsc85xx_driver[2].set_tunable’)
drivers/net/phy/mscc/mscc_main.c: In function ‘vsc8514_validate_inband_aneg’:
drivers/net/phy/mscc/mscc_main.c:2196:1: error: control reaches end of non-void function [-Werror=return-type]
2196 | }
| ^
cc1: some warnings being treated as errors
make[4]: *** [scripts/Makefile.build:287: drivers/net/phy/mscc/mscc_main.o] Error 1
make[3]: *** [scripts/Makefile.build:549: drivers/net/phy/mscc] Error 2
make[2]: *** [scripts/Makefile.build:549: drivers/net/phy] Error 2
make[1]: *** [scripts/Makefile.build:549: drivers/net] Error 2
make: *** [Makefile:1944: drivers] Error 2

0 Kudos

1,131 Views
Sanket_Parekh
NXP TechSupport
NXP TechSupport

Hi @builinhhh,

I hope you are doing well.


"As a matter of fact, I really hasn't known How to build the project."
"I want to utilize flash to use FlexSPI."
" I want connect STM32 with board imx8QM via SPI"
According to these statements, following are our suggestions:
- Could you please share more about which Linux version are you using to compile?
- Please make sure what you want to use. What are you currently using? What integrations have been made in your project? Which configurations are you currently using, we have shared enough of the contents of reference regarding flashing through flexspi.
- As far as SPI pins are concerned, one can configure CS pins as GPIO and use the kernel driver configurations.
- Kindly go through the reference manual and documentation related to it. Also go through the topic: FlexSPI (Quad SPI/Octal SPI), One can find it here: imx8 QM Industrial application processor datasheet and imx8 QM applications reference manual and IMX8QMAEC.
- There isn't a way to replicate your issue. Kindly go through the responses once again.
 
Thanks and Regards,
Sanket Parekh
0 Kudos

1,127 Views
builinhhh
Contributor II

My project is develope a security smartphone using imx 8MQ. Hardware is designed by third party. 
Now, because hardware hasn't completed, so I used i.MX 8M EVK kit temporary. 
We intend build base on Android 13.1.2.0 with kernel 5.15.84.

First, I want communicate between i.MX 8MQ and STM32 via SPI.
I built successfully source code android for imx8mq and flash image to board.

Then, I want test code by helloworld loadable kernel module. Can you send me source code of helloworld kernel module and Makefile?

After that, because in imx8 MQ EVK kit and imx8 QM MEK kit do not have spare pins for SPI, I intend test SPI by Flash because FLASH connected i.MX 8 by FLEX SPI. 

After your instructions, I enabled Flex SPI by make menuconfig and make. Then I flash image by uuu follow Android User's guide. But it hasn't any change. 
This my problems. Can you help me?

0 Kudos

1,083 Views
Sanket_Parekh
NXP TechSupport
NXP TechSupport

Hi @builinhhh,

I hope you are doing well.
 
"I want communicate between i.MX 8MQ and STM32 via SPI.
I built successfully source code android for imx8mq and flash image to board."
 
- As far as SPI pins are concerned, one can configure CS pins as GPIO and use the kernel driver configurations.

- For the hello world kernel module below are the suggestions to follow:
 
Thanks and Regards,
Sanket Parekh
0 Kudos

1,046 Views
builinhhh
Contributor II

Hi @Sanket_Parekh , your supports helped me very much, thank you.
I wrote and insmod Hello world Kernel module for imx 8QM, Now I want config SPI pins by Kernel module. How can I?

0 Kudos

1,037 Views
Sanket_Parekh
NXP TechSupport
NXP TechSupport
 
I hope you are doing well.
 
- Kernel code can explicitly manage exports of GPIOs that have already been requested using gpio_request():
 
/* export the GPIO to userspace */
int gpio_export(unsigned gpio, bool direction_may_change);

/* reverse gpio_export() */
void gpio_unexport();

/* create a sysfs link to an exported GPIO node */
int gpio_export_link(struct device *dev, const char *name, unsigned gpio)

/* change the polarity of a GPIO node in sysfs */
int gpio_sysfs_set_active_low(unsigned gpio, int value);
 
Other than these, we are providing some suggestions and references:
- If one wants to use SPI without CS pins configured.
- One can find SPI-GPIO device tree suggestions.
- Documentation for gpio.txt
- SPI driver for the Linux kernel.
 
Thanks and Regards,
Sanket Parekh
0 Kudos

993 Views
builinhhh
Contributor II

can you help me write a kernel module to blink led on imx 8m mek? I see a led on pin SCU_GPIO0_02 but I don't know how to blink it by kernel module

0 Kudos