1=================
So I was having a problem with my KSDK 1.2 based projects that used DMA, using KDS 3.0 where no matter what I was doing, they were dropping into the default IRQ.
When I started to dig I found that the DMA IRQ's were undeclared, and greyed out as not defined inside of the edma_irq file, because of a value called FSL_FEATURE_SOC_DMA_COUNT contained in the MK2251212_features.h file.
FSL_FEATURE_SOC_DMA_COUNT (0) ----> When I change this value to 16 (can't remember off hand but I think that's the number of DMA channels?), I get my DMA IRQ handler, and everything runs as it is supposed to. Not sure if this is the correct way to solve this, but would appreciate some input.
2 ====================
I'm working on a USB application from scratch (by copying the function and logic from an example....) which I can't solve a problem for after a while of trying, because I can't find where anything is actually declared half of the time in this API. I'm calling :
USB_Class_MSC_Init(USB_CONTROLLER_KHCI_0, &g_msd_config, &msd_handle);
Which gets me to ... usb_status usb_device_init ....
/* Initialize the USB controller chip */
if (dev_if->dev_init != NULL)
{
PROBLEM -----> error = dev_if->dev_init(controller_id,usb_dev_ptr->controller_handle);
}
else
{
......
And never beyond this function from a structure of pointers to functions. Drops into default IRQ.
In features we have, the correct number of USB devices.
In startup_MK22F51212.S i see def_irq_handler USB0_IRQHandler
And in MK22F51212.h I see
/** Interrupt vectors for the USB peripheral type */
#define USB_IRQS { USB0_IRQn } where USB0_IRQn = 53,
Where is does USB0 Irq actually live as a function and how do I get it into the vector table or whatever it is I need to do in order to get this initialization process to complete? It obviously doesn't use the interrupt handler /callback I've written into my code, or replace the address - so what do I need to do? Prior to the above mentioned function, NVIC 53 has a priority set, the interrupt set enable bit is set, and that the interrupt clear-enable bit is also set.I noticed that in my structures the Callback is assigned, but it says the address is "0x835" while the actual function appears to start at "0x834" - is this something I should also be concerned about? I've tried mass erase and getting rid of breakpoints completely to try to rectify but it's still not working.
3 ====================
What is the major difference between the SDK and BM adapter for the USB stack? Is there a specific reason that an example BM project has SDK selected in the adapter_config.h - is this correct? Because some of the example I've looked at are setup like this.
Thank you.
Hi Donald,
For question 1, I don't think changing FSL_FEATURE_SOC_DMA_COUNT (0) to 16 is a correct solution, actually there is no DMA module in K22F51212 , just eDMA available, so you may find #define FSL_FEATURE_EDMA_MODULE_CHANNEL (16) in the line 364 of MK22F51212_features.h, and DMA irq numbers in MK22F51212.h like below:
for question 2, I could not figure out why, as there are many possible causes for your issue, maybe the clock for USB module is not set up correctly , which should be 48MHz to get it work correctly, or maybe the clock gate for USB module is not enabled at that moment so it causes a bus fault exception, but anyway, if you want to build a USB application from scratch based on KSDK 1.2, you may use the PEx component in KDS 3.0, and if you want to make a MSC demo, you may refer to How to implement a USB Device MSD demo based on KSDK PEx components and KDS 3.0 for details.
For question 3, I think the following figure shows the difference, and since the USB stack uses low layer drivers from KSDK, so the examples selected SDK as the adapter in adapter_cfg.h.
Hope that helps,
Have a great day,
Kan
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
On #1 - If that's not the correct solution, then you guys should change the define in fsl_edma_irq.c to reflect the correct constant.
You have :
#include "fsl_edma_driver.h"
#if FSL_FEATURE_SOC_DMA_COUNT
Right at the top of the file. I would say you may want to have it be FSL_FEATURE_EDMA_MODULE_CHANNEL, if that's what it's actually supposed to depend on.
On #2 - I'll double check the clock registers / settings and see what happens.
Hi Donald,
Just some supplement for question 3:
For BM , SDK and RTOS like MQX , USB stack have a different OS APIs for each of them, so with different adapters we can make one code be used for all of them.
Have a great day,
Kan
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Changing
USB_Class_MSC_Init(USB_CONTROLLER_KHCI_0, &g_msd_config, &msd_handle);
to
USB_Class_MSC_Init(CONTROLLER_ID, &g_msd_config, &msd_handle);
At least gets some activity and enters the handler I assign, but still no dice beyond event 135, 136...