Salve, sono uno studente di ingegneria, avrei bisogno di una mano per imparare a progrmmare un micro MK10DN512ZVLL10. Qualcuno mi può supportare?
Salve, sono uno studente di ingegneria, avrei bisogno di una mano per imparare a progrmmare un micro MK10DN512ZVLL10. Qualcuno mi può supportare?
As for the development environment I installed the Kinetis Design Studio IDE freescale.
Link: http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=KDS_IDE
The card was made entirely by the Uni…
Should blink an LED, and when you press a button it Mantine on and measures the temperature. I do not know if the operation is so, also because I still have to start with the IDE ..... I did not under…
Ok ok, sorry all.
I state that I did a test on programming in C ++ but it's the first time I am confronted with a microcontroller. I do not have a deep knowledge mainly because I come from courses in telecommunications (electromagnetism, maxwell, microwave ...)
The univ. I put it has provision the MK10DN512ZVLL10 integrated on a card.
The goal is to control 3 inputs (antenna, an accelerometer (LSM330DL) and a strain gauge) and output (linear actuator). For the main program in C i have a idea (maybe), but I have no idea to control the structure of instructions to initialize the register, meters, reading and writing of micro devices ....
If you want I'll show you an example program that provided me and let's start with that. You have knowledge of the industry? You know someone who has? Tanks at you
I think that an example of a program it is a good starting point.
As a matter of fact I don't know this specific micro but I think that it can't be totally different by a lot of other that I have already saw. I will check on the net the architecture. In the meantime, please provide if you the links on the specific board you are using so I can take a look and hopefully help you. Another useful information is knowing what kind of development environment you will use to make this development, i.e. what development platform this board support.
Thank you.
As for the development environment I installed the Kinetis Design Studio IDE freescale.
Link: http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=KDS_IDE
The card was made entirely by the University. I can not find how to send an attachment...
I'll show the example program?
As for the development environment I installed the Kinetis Design Studio IDE freescale.
Link: http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=KDS_IDE
The card was made entirely by the University. I can not find how to send an attachment...
I'll show the example program?
To send an attachment program, you can zip it and attach to the post (worst solution) or copy and paste the code selecting the block on the post text. Then with the rightmost button in the editor bar with the ">>" select the syntax highlighting as C/C++ That's all
Should blink an LED, and when you press a button it Mantine on and measures the temperature. I do not know if the operation is so, also because I still have to start with the IDE ..... I did not understand much ... I have a lot of question
#include <MK10DZ10.h> #include <stdint.h> #include <stdbool.h> #include <stdio.h> #include "peripherals/tmp102.h" #include "core/uart.h" #define LED2_ON BITBAND_REG(PTB->PDDR, 17) = 1 // set pin dir to output #define LED2_OFF BITBAND_REG(PTB->PDDR, 17) = 0 // set pin dir to intput #define STDIO_UART1 bool audio_curr = false; volatile bool audio_toggle = false; volatile bool temperature_comm_ok = false, temperature_comm_err = false; void enable_btn_irq(); #ifdef STDIO_UART1 static uint8_t stdio_buff[80]; static ring_buffer stdio_ring_buffer; #endif static void init_hardware() { // enable clock gating for all ports SIM->SCGC5 |= (SIM_SCGC5_PORTA_MASK | SIM_SCGC5_PORTB_MASK | SIM_SCGC5_PORTC_MASK | SIM_SCGC5_PORTD_MASK | SIM_SCGC5_PORTE_MASK); // pins for voltage regulators // 3.0 V PORTB->PCR[11] = PORT_PCR_MUX(1); BITBAND_REG(PTB->PDDR, 11) = 1; // output PTB->PSOR = (1u << 11); // output = 1, vreg enabled // 3.3 V PORTA->PCR[5] = PORT_PCR_MUX(1); BITBAND_REG(PTA->PDDR, 5) = 1; // output PTA->PSOR = (1u << 5); // output = 1, vreg enabled // pins for LED2 and LED3. By default, output register is 0 PORTB->PCR[17] = PORT_PCR_MUX(1); PORTB->PCR[16] = PORT_PCR_MUX(1); // pins for buttons: pull-up, interrupt on either edge PORTD->PCR[0] = PORT_PCR_MUX(1) | PORT_PCR_IRQC(11) | PORT_PCR_PE_MASK | PORT_PCR_PS_MASK; PORTC->PCR[18] = PORT_PCR_MUX(1) | PORT_PCR_IRQC(11) | PORT_PCR_PE_MASK | PORT_PCR_PS_MASK; PORTC->PCR[17] = PORT_PCR_MUX(1) | PORT_PCR_IRQC(11) | PORT_PCR_PE_MASK | PORT_PCR_PS_MASK; PORTC->PCR[16] = PORT_PCR_MUX(1) | PORT_PCR_IRQC(11) | PORT_PCR_PE_MASK | PORT_PCR_PS_MASK; // enable clock gating for PIT BITBAND_REG(SIM->SCGC6, SIM_SCGC6_PIT_SHIFT) = 1; // enable PIT (periodic interrupt timer) PIT->MCR = 0; // clock enabled // use PIT channel 1 for debouncing PIT->CHANNEL[1].LDVAL = busClock / 50; // 20 ms between subsequent button events PIT->CHANNEL[1].TCTRL = 0; // initially disabled NVIC_SetPriority(PIT1_IRQn, 15); NVIC_EnableIRQ(PIT1_IRQn); // enable IRQ for buttons NVIC_SetPriority(PORTC_IRQn, 15); NVIC_SetPriority(PORTD_IRQn, 15); enable_btn_irq(); // pins for misc. peripherals PORTB->PCR[20] = PORT_PCR_MUX(1); // reset for radio chip BITBAND_REG(PTB->PDDR, 20) = 1; // output PORTD->PCR[1] = PORT_PCR_MUX(1); // LT BITBAND_REG(PTD->PDDR, 1) = 1; // output PORTC->PCR[1] = PORT_PCR_MUX(1); // GPS_EN BITBAND_REG(PTC->PDDR, 1) = 1; // output PORTB->PCR[9] = PORT_PCR_MUX(1); // SENSE_EN BITBAND_REG(PTB->PDDR, 9) = 1; // output PORTE->PCR[25] = PORT_PCR_MUX(1); // AUDIO_EN BITBAND_REG(PTE->PDDR, 25) = 1; // output } int main(void) { init_hardware(); // blink leds with period = 1s, using PIT channel 0 //LED_ON(2); PIT->CHANNEL[0].LDVAL = busClock / 2u; // 0.5 s PIT->CHANNEL[0].TCTRL = PIT_TCTRL_TEN_MASK | PIT_TCTRL_TIE_MASK; NVIC_SetPriority(PIT0_IRQn, 5); NVIC_EnableIRQ(PIT0_IRQn); #ifdef STDIO_UART1 // enable GPS connector to be used as external UART connection PTC->PSOR = (1u << 1); ring_buffer_init(&stdio_ring_buffer, stdio_buff, sizeof(stdio_buff), UART1_RX_TX_IRQn, -1); uart_enable(1, 115200, true, true, &stdio_ring_buffer); printf("ready.\r\n"); #endif for(;;) { if (audio_toggle) { // user toggled the audio audio_toggle = false; audio_curr = !audio_curr; if (audio_curr) { // turn audio on (not implemented) LED2_ON; // read temperature tmp102_enable(); tmp102_start_read(); } else { // turn audio off LED2_OFF; } } else if (temperature_comm_ok || temperature_comm_err) { printf("Temp: "); if (temperature_comm_ok) { uint16_t t = tmp102_get(); printf("%u.%u\r\n", t / 16, ((t % 16) * 10 + 8) / 16); } else printf("ERR\r\n"); temperature_comm_ok = false; temperature_comm_err = false; tmp102_disable(); } } } // reimplementation of _write and _read weak functions, to redirect stdio // and not use the default semihosting int _write (int fd, const void *buf, size_t count) { (void)fd; (void)buf; (void)count; #ifdef STDIO_UART1 return uart_queue_tx(1, buf, count); #else return 0; #endif } int _read (int fd, const void *buf, size_t count) { (void)fd; (void)buf; (void)count; return 0; }
Well, now the scenario is quite celar. And as for what I see in the schematic this micro controller is not so more difficult than many others. Unfortunately I didn't use the IDE you mention (any processor / producer adopt a different C IDE and development environment, sigh!)
I suggest - if I can suggest the steps you need to path - to start first creating the development environment, ide, libraries and all that you have in your documentation to be able to move on the programming questions without problems like where to find a component, why does a part does not work, compile etc.
The first thing should be - blindy - trying to be able to compile the small program, leaving untouched it and find all the practical issues .e.g. the correct procedure to upload the program to the board, etc.
I suggest also in this phase to see if your board has a bootloader or not, how should be programmed (supposing some kind of hardware connection). Then when you have a sort of running echosystem you can approach the real problems.
Keep us updated.
Hi, how are you??
I did not understand some instructions first. I have some basic questions ...
For example:
PORTB->PCR[11] = PORT_PCR_MUX(1);
BITBAND_REG(PTB->PDDR, 11) = 1; // output
PTB->PSOR = (1u << 11); // output = 1, vreg enabled
There is a particular reason because it uses PDDR?
I see in the program of MICRO other GPIO Register Masks. It would have been equal usarne another? And the 17? And (1u<<11)?
What do this?
#ifdef STDIO_UART1
static uint8_t stdio_buff[80];
static ring_buffer stdio_ring_buffer;
#endif
PORTA, PORTB, PORTC what gate is??
In the program of micro i see 29, what are ??
#define SIM_SCGC6_RTC_MASK 0x20000000u
#define SIM_SCGC6_RTC_SHIFT 29