Show Posts

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.


Topics - Raffaele

Pages: 1 [2]
16
Hi,

I have a task that gets periodically executed every 0.8 because of "Host debugger" (i.e. (RCM_SRS1 & RCM_SRS1_MDM_AP) != 0)), as in my task I have: uTaskerMonoTimer('Y', (DELAY_LIMIT) (0.8 * SEC), UTASKER_STOP); so it repeatedly prints out a serial string. What does it mean?

However, I'm expecting it to be executed only upon UART reception. And btw if I connect my board to a device outputting UART data my board stalls


17
µTasker general / Max number of new Tasks
« on: May 09, 2020, 04:47:38 PM »
Hi,
is there a max number of new tasks that can be added to the project?

Apparently if I write more than 6 new tasks and add them to TaskConfig.h, even if I execute only 1 of them (as I always do) then my microcontroller (KL03) doesn't work any more.
I'm not sure if it is a matter of memory since this happens even when the 7th task is an empty function. As I remove the 7th task things go back to normal

18
µTasker general / SPI Slave config on KL03
« on: February 21, 2020, 03:32:04 PM »
Hi,

is there a basic configuration to set up an SPI slave interface on the KL03?
I am able to configure an SPI master, what do I need to change for a slave?

Thanks

19
µTasker general / UART Tx/Rx in different pins for KL03
« on: January 09, 2020, 12:24:09 AM »
Hi,
is it possible to set up the LPUART Tx and Rx on two different pins in the KL03? I tried something like the following code, I can transfer but not receive. I don't know if my receive routine is correct:


Code: [Select]
#include "config.h"

#define SET_UART_PORT() _CONFIG_PERIPHERAL(B, 3,  (PB_3_LPUART0_TX | UART_PULL_UPS ));\
_CONFIG_PERIPHERAL(B, 1,  (PB_1_LPUART0_RX | UART_PULL_UPS ));


#define SERIAL_INTERFACE

static int iState = 0;

static void fn_process_data() {
         unsigned char ucInputByte;
while (fnRead( SerialPortID, &ucInputByte, 1) != 0) {
while (ucInputByte--) {
fnDebugMsg("\r\n");
fnDebugDec(ucInputByte, 0);
}
}
}


extern void fnTaskMyUartToSPI(TTASKTABLE *ptrTaskTable) {
switch (iState) {

case 0 :

SET_UART_PORT();

TTYTABLE tInterfaceParameters; // table for passing information to driver
QUEUE_HANDLE SerialPortID; // UART handle to be obtained during open
tInterfaceParameters.Channel = 0; // set UART channel for serial use
tInterfaceParameters.ucSpeed = SERIAL_BAUD_115200;
tInterfaceParameters.Rx_tx_sizes.RxQueueSize = 256; // input buffer size
tInterfaceParameters.Rx_tx_sizes.TxQueueSize = 512; // output buffer size
tInterfaceParameters.Task_to_wake = TASK_MY_UART_TO_SPI; // wake task on rx
#ifdef SUPPORT_FLOW_HIGH_LOW
tInterfaceParameters.ucFlowHighWater = 80; // set the flow control high in %
    tInterfaceParameters.ucFlowLowWater = 20; // set the flow control low in %
#endif
tInterfaceParameters.Config = (CHAR_8 + NO_PARITY + ONE_STOP +  CHAR_MODE);

if ((SerialPortID = fnOpen( TYPE_TTY, FOR_I_O, &tInterfaceParameters)) != 0) {
// open the channel with defined configurations (initially inactive)
fnDriver(SerialPortID, ( TX_ON | RX_ON ), 0); // enable rx and tx
}

DebugHandle = SerialPortID;

iState = 1;
break;


case 1 :
fn_process_data();
break;
}
}


20
µTasker general / Task executed only once and then from interrupt
« on: January 03, 2020, 01:59:27 AM »
Hi I have a task that should be executed once (to set up some pins and variables) and then executed based on an external interrupt. However the task is executed periodically and every time it repeats the set-up. Basically, the if (iState) is entered periodically and the OUTPUT_PIN doesn't stay low but goes high between executions


#include "config.h"

#define OUTPUT_PIN              PORTB_BIT5
#define SETUP_PIN()  _CONFIG_DRIVE_PORT_OUTPUT_VALUE(B, OUTPUT_PIN, OUTPUT_PIN, (PORT_SRE_FAST | PORT_DSE_LOW));
#define SET_PIN_LOW()      _CLEARBITS(B, OUTPUT_PIN)
#define SET_PIN_HIGH()     _SETBITS(B, OUTPUT_PIN)   

static int iState = 0;

static void fn_my_interrupt(void)
{
   fnInterruptMessage(TASK_MY_INTERRUPT, 141);
}



extern void fnTaskMyInterrupt(TTASKTABLE *ptrTaskTable) {

   QUEUE_HANDLE PortIDInternal = ptrTaskTable->TaskID;
   unsigned char ucInputMessage[MEDIUM_MESSAGE];
   
   if (!iState) {
      SETUP_PIN();
      SET_PIN_LOW();
      
            INTERRUPT_SETUP interrupt_setup;                                     // interrupt configuration parameters
       interrupt_setup.int_type       = PORT_INTERRUPT;                     // identifier to configure port interrupt
       interrupt_setup.int_handler    = fn_my_interrupt;                    // 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  = PORTB_BIT4;                      // the IRQ input connected
       interrupt_setup.int_port_sense = IRQ_FALLING_EDGE ;// | PULLUP_ON);     // interrupt is to be falling edge sensitive
       fnConfigureInterrupt((void *)&interrupt_setup);
       iState = 1;
       //uTaskerStateChange(TASK_MY_INTERRUPT, UTASKER_SUSPENDED);
   }


   while (fnRead( PortIDInternal, ucInputMessage, HEADER_LENGTH)) {
      switch (ucInputMessage[MSG_SOURCE_TASK]) {
      case 141 :
         // YOUR CODE HERE //
         SET_PIN_HIGH();
      break;
      }
      break;
      }
}




21
µTasker general / uTasker V1.4.11 KDS Studio compile error FreeRTOS folder
« on: December 22, 2019, 11:24:38 PM »
Hi all,
anyone experiencing problems with last uTasker V1.4.11 code? I downloaded it from the GIT, followed the instructions of the video https://www.youtube.com/watch?v=K8ScSgpgQ6M as usual, but the compiling fails.

 I have an error at \uTasker-Kinetis-master\FreeRTOS\Source\portable\RVDS\ARM_CM4_MPU\port.c
 #include "FreeRTOS.h"  <- fatal error: FreeRTOS.h: no such file or directory

22
Hi,
I need a minimal code for the KL03 that defines an SPI master interface using the ALT3 pin configuration (B0 CLK, A3 MOSI, A5 SS, A6 MISO) and prints the result on UART. I want to disable everything that is not necessary.
Few questions:

1) Do I need to comment some of the functions in TaskConfig.h? I commented the wdog and app but apparently they are needed (?) otherwise I can't print to UART
2) I assume, I might be wrong though, that the SPI ALT3 configuration is already defined, but how do I enable the ALT3 instead of the default SPI, and where do I change the parameters (CLK etc)?
3) What function do I need to call to actually enable SPI?

I read this http://www.utasker.com/forum/index.php?topic=1902.0 so I know how to set up the SPI interface but  in app_hw_kinetis.h I can't find the INITIALISE_SPI_SD_INTERFACE() for the KL03

Thank you

23
NXPTM M522XX, KINETIS and i.MX RT / [Kinetis KL03] Print timestamp
« on: January 16, 2019, 03:41:41 AM »
Hi,
I'm looking for a simple way to print a timestamp via UART, or the time elapsed between two events. The code that I have is normally working. I tried the function time() (I included time.h from the C standard libraries), the building doesn't give errors but the .bin file is not generated.
What I did was simply

#include <time.h>
...
time_t now = time(NULL);


The function time(NULL) is creating the issue.
Any suggestion?

Thank you

24
NXPTM M522XX, KINETIS and i.MX RT / [Kinetis KL03] Custom pin assignments
« on: November 26, 2018, 07:52:36 PM »
Hi all,

on page 48 of the Kinetis KL03 datasheet https://www.nxp.com/docs/en/data-sheet/KL03P24M48SF0.pdf   the signals available on each pin are reported.

My question is: can I change this assignments?
Let's say I want to assign a timer TPM0_CH0 to PTB4 as ALT2 function. Now, ALT2 function is already assigned to PTB4 and it is an I2C0_SDA. Or I could also assign TPM0_CH0 as ALT4 since it is empty.

I know how to use the _CONFIG_PERIPHERAL to select the function that I want on a pre-assigned pin, but I don't know IF/HOW to reassign functions to a pin.
If this is possible, which function/registers do I need to change? And in which file are they?

Thank you

25
Hi,
I'm having some problems with running simple tasks for the FRDM-KL03.

1)
As a first step I tried something very simple: adding a fnDebug("Hello World!"); in the file Watchdog.c before the function fnRetriggerWatchdog();
I followed the guide to build the project (did it for FLASH).
Opened the terminal for serial communication at baud rate 19200
Copied the .bin file created in "Applications\uTaskerV1.4\KinetisDesignStudio\uTaskerV1.4_FLASH" to the board.

But nothing is printed to the terminal.
I also built the project in Visual Studio and set a breakpoint in the Watchdog.c file to be sure the function is reached, and yes it is.


2)
I tried to create my own task. Following the  guide (http://www.utasker.com/docs/uTasker/uTaskerV1.4_user_guide.PDF   chapter 5):
I created my .c file with a function that generates PWM signals:



Code: [Select]
#include "config.h"

extern void fnTaskMyPWM(TTASKTABLE *ptrTaskTable){
    PWM_INTERRUPT_SETUP pwm_setup;
    pwm_setup.int_type = PWM_INTERRUPT;
    pwm_setup.int_handler = 0;                                           
    pwm_setup.pwm_mode = (PWM_CLOCK | PWM_PRESCALER_16);
    pwm_setup.pwm_frequency = PWM_FREQUENCY(20000, 16);
    pwm_setup.pwm_reference = (_TIMER_0 | 0);
    fnConfigureInterrupt((void *)&pwm_setup);
    pwm_setup.pwm_reference = (_TIMER_0 | 1);                            // timer module 0, channel 1
    fnConfigureInterrupt((void *)&pwm_setup);                           
    pwm_setup.pwm_reference = (_TIMER_1 | 0);                            // timer module 0, channel 1
   // pwm_setup.pwm_frequency = PWM_TIMER_US_DELAY(TIMER_FREQUENCY_VALUE(20), 4);// generate 20000Hz on PWM output
    pwm_setup.pwm_reference = (_TIMER_1 | 1);                            // timer module 1, channel 0
    fnConfigureInterrupt((void *)&pwm_setup);                           
    pwm_setup.pwm_value   = _PWM_PERCENT(50, pwm_setup.pwm_frequency);   // 50% PWM (high/low)
    fnConfigureInterrupt((void *)&pwm_setup);   
}

I launch the task from TaskConfig.c with
Code: [Select]
{"x", fnTaskMyPWM, NO_QUE, (DELAY_LIMIT)(2 * SEC), 0, UTASKER_GO},However I can't see any PWMs on PA0, PB5, PB10 or PB11.
I also tried to generate only 1 signal at the time instead of 4, but nothing.

Pages: 1 [2]