How do you use DSPI_DRV_MasterTransferData in the fsl_dspi bean?

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you use DSPI_DRV_MasterTransferData in the fsl_dspi bean?

Jump to solution
655 Views
robotjosh
Contributor IV

I have created a blank project using kinetis sdk (it forces you to use kinetis sdk) and processor expert for the K22FN512 that has nothing but a fsl_dspi bean added.  The auto-init options are checked and I have verified that MasterConfigureBus gets called within PE_low_level_init. In addition to including stdint.h, the following is the code I have added to the blank project:

 

  uint8_t rxbuf[256];

  uint8_t txbuf[256];

  DSPI_DRV_MasterTransferData(FSL_SPICOM1, 0, txbuf, rxbuf, 10);

  while(1);

 

This code compiles without any warnings or errors but when it runs it ends up at the default interrupt handler in an endless loop.  Pausing the debugger shows that it is here:

 

Default_Handler:

  b .

  .size Default_Handler, . - Default_Handler

 

I've given this code plenty of time to run and have concluded that it is never going to exit this loop.  It looks like there is supposed to be an interrupt handler for the fsl_dspi bean but I don't see any options for that in processor expert.  What am I missing?

Labels (1)
1 Solution
238 Views
anthony_huereca
NXP Employee
NXP Employee

Try adding the fsl_dspi_irq.c file to your project, which can be found at C:\Freescale\KSDK_1.0.0\platform\drivers\dspi

It shouldn't require any modifications, just need to add that file to your project. And yes, you shouldn't need to add any code to the fsl_dspi_master_driver.c, so if you're still having issues, try removing that line you added and try again.

View solution in original post

0 Kudos
4 Replies
238 Views
robotjosh
Contributor IV

I don't think I'm supposed to modify fsl_dspi_master_driver.c but I've added the following line below /* enable the interrupt */ in DSPI_DRV_MasterInit():

INT_SYS_InstallHandler(g_dspiIrqId[instance], (void*)DSPI_DRV_MasterIRQHandler);

This allows DSPI_DRV_MasterTransferData to work for transfer size of 1 but when 2 or greater transfer size is used it still goes to an unhandled interrupt.  Is there another place I should be installing these interrupt handlers?  Some function that does it?  Seems like I shouldn't be editing fsl_dspi_master_driver.c.

0 Kudos
239 Views
anthony_huereca
NXP Employee
NXP Employee

Try adding the fsl_dspi_irq.c file to your project, which can be found at C:\Freescale\KSDK_1.0.0\platform\drivers\dspi

It shouldn't require any modifications, just need to add that file to your project. And yes, you shouldn't need to add any code to the fsl_dspi_master_driver.c, so if you're still having issues, try removing that line you added and try again.

View solution in original post

0 Kudos
238 Views
robotjosh
Contributor IV

I don't have time to try this but will assume it works and will be in the next sdk release.  My problem is solved by using pex without ksdk.

0 Kudos
238 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Josh,

From your this words "(it forces you to use kinetis sdk)"  , if you want use PE without SDK,  you can update a patch (KV3x |Kinetis KV3x BLCD MCUs|Freescale)  in KDS. (update step you can refer to the document of  attchment  , the "Updating Offline" part ).

This patch:

pastedImage_1.png

After updated ,  when you create project chose like this :

pastedImage_0.png

And i will continue check the interrupt files of SDK .

Best Regards

Alice

------------------------------------------------------------------------------------------

If this post answers your question, please click the Correct Answer button.

-----------------------------------------------------------------------------------

If this post help your question, please click the helpful Answer button.