16
µTasker general / Re: Incorrect PWM frequency
« on: October 01, 2020, 02:36:14 PM »
great, that worked
thank you
thank you
Nov 2020: uTasker i.MX RT V1.4.12 is productive - with complete secure loading concept.
Follow uTasker updates at www.twitter.com/uTasker !!
Online Forum registration has now been disabled. Please send an email to an address at the bottom of the home page with your preferred user name and email address if you would like an account.
Return to uTasker main site: www.utasker.com
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
pwm_setup.pwm_mode = (PWM_SYS_CLK | PWM_PRESCALER_1);
pwm_setup.pwm_frequency = PWM_TIMER_US_DELAY(TIMER_FREQUENCY_VALUE(650000), 1);
pwm_setup.pwm_value = _PWM_PERCENT(50, pwm_setup.pwm_frequency);
int const SLEEP = 1;
int const RX = 2;
extern void stateMachineTask(TTASKTABLE *ptrTaskTable){
switch (iState) {
case 0 :
steupIinterruptHandler();
iState = 1;
uTaskerMonoTimer('C', (DELAY_LIMIT) (0.5 * SEC), UTASKER_ACTIVATE);
break;
case SLEEP :
deactivate_data_processing();
// do sleep operations here
iState = RX;
uTaskerMonoTimer('C', (DELAY_LIMIT) (T1 * SEC), UTASKER_ACTIVATE);
break;
case RX :
activate_data_processing();
//if received interrupt, process data
iState = SLEEP;
uTaskerMonoTimer('C', (DELAY_LIMIT) (T2 * SEC), UTASKER_ACTIVATE);
break;
}
}
#define INITIALISE_SPI_SD_INTERFACE() POWER_UP(4, SIM_SCGC4_SPI0); \
_CONFIG_PERIPHERAL(B, 0, PB_0_SPI0_SCK); \
_CONFIG_PERIPHERAL(A, 7, (PA_7_SPI0_MOSI | PORT_SRE_FAST | PORT_DSE_HIGH)); \
_CONFIG_PERIPHERAL(A, 6, (PA_6_SPI0_MISO | PORT_PS_UP_ENABLE)); \
_CONFIG_DRIVE_PORT_OUTPUT_VALUE(A, SPI_CS1, SPI_CS1, (PORT_SRE_FAST | PORT_DSE_HIGH));\
_CONFIG_DRIVE_PORT_OUTPUT_VALUE(A, SPI_CS2, SPI_CS2, (PORT_SRE_FAST | PORT_DSE_HIGH));\
SPI0_C1 = (SPI_C1_CPHA | SPI_C1_CPOL | SPI_C1_MSTR | SPI_C1_SPE); \
SPI0_BR = (SPI_BR_SPPR_PRE_4 | SPI_BR_SPR_DIV_2); \
(void)SPI0_S; (void)SPI0_D;
#define LPUART_IRC48M // if the 48MHz clock is available clock the LPUART from it
//#define LPUART_OSCERCLK // clock the LPUART from the external clock
//#define LPUART_MCGIRCLK // clock the LPUART from MCGIRCLK (IRC8M/FCRDIV/LIRC_DIV2) - default if others are not defined
INTERRUPT_SETUP interrupt_setup;
interrupt_setup.int_type = PORT_INTERRUPT; // identifier to configure port interrupt
interrupt_setup.int_handler = fn_my_interrupt_handler; // handling function
interrupt_setup.int_priority = PRIORITY_PORT_B_INT; // interrupt priority level
interrupt_setup.int_port = PORTB; // the port that the interrupt input is on
interrupt_setup.int_port_bits = INTERRUPT_PIN; // the IRQ input connected
interrupt_setup.int_port_sense = (IRQ_RISING_EDGE | PULLUP_ON); // interrupt is to be falling edge sensitive
fnConfigureInterrupt((void *)&interrupt_setup);
suspend_interrupt();
function();
reactivate_interrupt();