Adding peripherals to MCUXpresso project: What am I missing?

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

Adding peripherals to MCUXpresso project: What am I missing?

Jump to solution
1,080 Views
GaryOlmstead
Senior Contributor I

I am developing a project with a Kinetis K60, MCUXpresso 11.1.0, Windows 10, "bare metal". For this project, I used the Quick Start panel as much as possible, and added the ADC module to the project when I created it.

So, in CodeWarrior/ Processor Expert, if I wanted to add, say, an ADC module, I went to the component library, selected an ADC block, then went through the checklist to configure it, and when I compiled, it generated all the necessary code, including calls from the start up routine to initialize the peripheral.  If I made a choice that blocked other choices, those were grayed out and not selectable.  If I changed, say, the system clock speed in one peripheral that messed up another one, it complained.   Good.

In MCUXpresso, I select Pins and get a list of peripherals.  I expand ADC0 and select, say, SE,3 = pin 20.  There's nothing else to select, so I go to Clocks and discover that nothing there is related to the ADC, so I go to Peripherals, and get a file called "fsl_adc16.C" which contains a whole bunch of assumed settings, none of which I was asked about.  I have to look up what I want, hunt down the selections, and change them one by one.  If I change one that messes up something else, that's tough, there's no warning.

The MCUXpresso User Guide spends several chapters on creating projects by various means and adding peripherals, but then jumps directly to debugging, without spending even one page on customizing the peripheral.

My question is, is there a simple, modern way to set up peripherals, or is it back to the stone age?

0 Kudos
Reply
1 Solution
979 Views
diego_charles
NXP TechSupport
NXP TechSupport

Hello GaryOlmstead

Sorry for my late response. 

Config tools help you to configure/customize pins, peripherals, and clocks using a graphical interface, it will modify

The files   pin_mux.c  peripherals.c and clocks. creating function calls and configuration structures.

  Please check the MCUXpresso Config Tools User's Guide for more reference.

 

Here you can see and small example of use.

 

After clicking on Config Tools> peripherals and checking the ADC0 box The tool shows a code preview

With the current configuration  of the ADC0 that will be implemented when you click on Update code.

peripherals.png

 You are also able to configure the ADC channel that you desire

peripherals_ADC_2.png

 Also, you can set the mux alternative for the pin that will work as an ADC pin. Config tools->Pins, then you select the pin, and click on update code to get the code generated by the tool

pins.png

the same can apply to Config Tools-> clocks, where you can change the clock options. 

If you have the calls in your code, the configurations are going to be effective. 

int main(void) {
/* Init board hardware. */
BOARD_InitBootPins();
BOARD_InitBootClocks();
BOARD_InitBootPeripherals();

Please let me know if I can help you further

Best regards,Diego.

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

View solution in original post

0 Kudos
Reply
2 Replies
980 Views
diego_charles
NXP TechSupport
NXP TechSupport

Hello GaryOlmstead

Sorry for my late response. 

Config tools help you to configure/customize pins, peripherals, and clocks using a graphical interface, it will modify

The files   pin_mux.c  peripherals.c and clocks. creating function calls and configuration structures.

  Please check the MCUXpresso Config Tools User's Guide for more reference.

 

Here you can see and small example of use.

 

After clicking on Config Tools> peripherals and checking the ADC0 box The tool shows a code preview

With the current configuration  of the ADC0 that will be implemented when you click on Update code.

peripherals.png

 You are also able to configure the ADC channel that you desire

peripherals_ADC_2.png

 Also, you can set the mux alternative for the pin that will work as an ADC pin. Config tools->Pins, then you select the pin, and click on update code to get the code generated by the tool

pins.png

the same can apply to Config Tools-> clocks, where you can change the clock options. 

If you have the calls in your code, the configurations are going to be effective. 

int main(void) {
/* Init board hardware. */
BOARD_InitBootPins();
BOARD_InitBootClocks();
BOARD_InitBootPeripherals();

Please let me know if I can help you further

Best regards,Diego.

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

0 Kudos
Reply
979 Views
GaryOlmstead
Senior Contributor I

Hi Diego --

I spent the weekend messing with it, and I think I have a handle on it now.  Part of the problem was that I had so many windows open within MCUXpresso that the one where you have all the ADC settings, was covered up, so it looked like there was nothing to set.

Thanks for your help.

Gary

0 Kudos
Reply