migrating SPI driver to MQX

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

migrating SPI driver to MQX

Jump to solution
1,183 Views
JULIOOSVALDOANG
Contributor I

Hi there

I´m migrating an (working) SPI driver to MQX.

I had to install the SPI interruption something like this:

_int_install_isr(0x2b, (INT_ISR_FPTR)SPIB_ISR, NULL);

the interruption takes place (vector 0x2b) in my own

ISR I'm  accessing to SPI register. I can see that the registers

actually get the correct value but the SPI data never goes out,

I mean I can get the MOSI  data signals with an oscilloscope. So

I'm stock rigth now

Could someone suggest me how to proceed?

thanks in advance

--> Julio

Tags (3)
0 Kudos
1 Solution
582 Views
RadekS
NXP Employee
NXP Employee

In case of interrupt, you have two options how to install it:

1. MQX managed isr

_int_install_isr(vector, isr_ptr, isr_data);

_bsp_int_init(vector, priority, subpriority, enable);

2. Kernel isr to interrupt MQX

_int_install_kernel_isr(Vector, isr_ptr); /* works only for vector table located in the RAM */

_bsp_int_init(vector, priority, subpriority, enable);

When vector table is in flash, you can install your kernel isr into the hw vector table in vectors.c in BSP project. MQX doesn’t know about this interrupt therefore you cannot call MQX API from this interrupt.

Since you want use driver which is independent on MQX, I guess that Kernel isr is option what you are looking for. Anyway, you have to use also _bsp_int_init() function for enabling this interrupt.

There could be some also issues due to concurrence with MQX SPI driver. Please look at BSP code and check MQX SPI driver initialization. BSPCFG_ENABLE_SPIx in user_config.h should be zero otherwise MQX SPI driver will be initialized in _bsp_init() function.

I hope it helps you.


Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
2 Replies
583 Views
RadekS
NXP Employee
NXP Employee

In case of interrupt, you have two options how to install it:

1. MQX managed isr

_int_install_isr(vector, isr_ptr, isr_data);

_bsp_int_init(vector, priority, subpriority, enable);

2. Kernel isr to interrupt MQX

_int_install_kernel_isr(Vector, isr_ptr); /* works only for vector table located in the RAM */

_bsp_int_init(vector, priority, subpriority, enable);

When vector table is in flash, you can install your kernel isr into the hw vector table in vectors.c in BSP project. MQX doesn’t know about this interrupt therefore you cannot call MQX API from this interrupt.

Since you want use driver which is independent on MQX, I guess that Kernel isr is option what you are looking for. Anyway, you have to use also _bsp_int_init() function for enabling this interrupt.

There could be some also issues due to concurrence with MQX SPI driver. Please look at BSP code and check MQX SPI driver initialization. BSPCFG_ENABLE_SPIx in user_config.h should be zero otherwise MQX SPI driver will be initialized in _bsp_init() function.

I hope it helps you.


Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
582 Views
JULIOOSVALDOANG
Contributor I

thanks  a lot RadekS

the actual fix were enable BSPCFG_ENABLE_SPI1 in user_config.h (I´m using SPI1)

and now is working. I installed the interrupt  with the MQX ISR manager

_int_install_isr(vector, isr_ptr, isr_data);

_bsp_int_init(vector, priority, subpriority, enable);

0 Kudos