How does PE generate code from the config file.

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

How does PE generate code from the config file.

1,261 次查看
andrewparlane
Contributor IV

Hi, I'm having some problems getting DMA to work both with serial and SPI.

I am using the K20D50-FRDM board, hand referring to the "K20 Sub-Family Reference Manual, Rev. 2, Feb 2012" documentation.

For the DSPI peripheral I see that it can either generate interrupts or DMA requests which makes sense, based on the value of TFFF_DIRS and RFDF_DIRS bits in the SPIx_RSER register. I see no options in the Component inspector for the SPIMaster_LDD relating to DMA. If I were using eCos my next approach would be to look at the generic driver code, see if there's anything that sets these bits and check what the #ifdef it was inside, then look up where that gets defined, and figure out how it maps to the config file. With PE I haven't found anyway of doing this.

If it was just about those bits though, I could use the PDD functions to set them, and all would be fine. However the driver is set up to only enable interrupts (and I think this includes DMA requests) once you call SendBlock. Which requires a buffer and data, but that should be sent through the DMA component and not through the SPI one, or the SPI component should be configured to pass it on to the DMA code. Nothing of the sort is in the generated code.

Not to mention that the SPI driver is kind of crap, the peripheral has a FIFO for Tx and Rx Which can store 4x 16bit values. The default driver however just pushes one byte at a time. The only way I can see to improve this is to copy the generated code and add to it, and not have it auto generated any more. Which is pretty annoying, because then I can no longer change the clock config or other options through the config file, I have to go dig through the registers and find how to change it manually. Nor will PE track which pins are being used, and therefore it won't warn me if I try to use the same pins for another component. All of this I can work around but it would be so much better if I could just edit the template for the code.

Am I completely missing the point here, is there a simple solution to all of this? I found "IO_Serial.int" in "C:\Freescale\PExDrv v10.3\eclipse\ProcessorExpert\Beans\Bareboard" which shows me where the config options come from. However when I search in all file in C:\Freescale for "HAL_UART_TStopBitLen" the value in the "Name" field for the stop bit length config option, I found 0 instances except for in that file (the one in the Name field, and one in the PreparedHint field).

Any help would be appreciated,

Andrew

标记 (5)
0 项奖励
回复
2 回复数

998 次查看
andrewparlane
Contributor IV

Another issue I have is using the DMAChannel_LDD. The generated code doesn't compile with:

'DMA1_TDeviceData' has no member named 'SavedISRSettings_TramsferComplete'DMA1.c/evaluation/Generated_Codeline 303C/C++ Problem

The generated code, in the init function is:

/* Transfer complete interrupt vector(INT_DMA0) allocation */

  /* {MQXLite RTOS Adapter} Save old and set new interrupt vector (function handler and ISR parameter) */

  /* Note: Exception handler for interrupt is not saved, because it is not modified */

  DevDataPtr->SavedISRSettings_TramsferComplete.isrData = _int_get_isr_data(LDD_ivIndex_INT_DMA0);

  DevDataPtr->SavedISRSettings_TramsferComplete.isrFunction = _int_install_isr(LDD_ivIndex_INT_DMA0, DMA1_INT_DMA0_TransferComplete_ISR,  DevDataPtr);

I add:

LDD_RTOS_TISRVectorSettings SavedISRSettings_TramsferComplete; /* {MQXLite RTOS Adapter} Saved settings of allocated interrupt vector */

to the DMA1_TDeviceData struct, and rebuild which fixes it. However EVERY time I change any config option for ANY component it regenerates the code removing my fix.

This may be my fault and there could just be a simple option I'm missing somewhere, however I can't figure this out because I can't work out what option to set to have SavedISRSettings_TramsferComplete added to the struct automatically. If it is a genuine bug it would be a simple fix, if I could change how the code gets generated.

This works fine the the Serial_LDD component by the way, which is where I found the fix.

0 项奖励
回复

998 次查看
marek_neuzil
NXP Employee
NXP Employee

Hello Andrew,

Thank you for reporting of this bug. The DMAChannel_LDD issue (with MQXLite) was already reported and fixed. Please, use the PEx Driver Suite 10.4.1 version.

Best Regards,

Marek Neuzil

0 项奖励
回复