migrating SPI driver to MQX

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

migrating SPI driver to MQX

跳至解决方案
1,169 次查看
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

标记 (3)
0 项奖励
1 解答
568 次查看
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 项奖励
2 回复数
569 次查看
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 项奖励
568 次查看
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 项奖励