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.


Messages - Raffaele

Pages: 1 2 [3] 4 5
31
great very clear.
Btw it's the qHandle that is 0 not the address, is this a problem or is it fine?

32
Thank you Mark, I'm still investigating this.

A couple of things:
1) I couldn't locate the _LPUART_interrupt() in the whole project. I'm using the free version
2) I forced the function fnRead(SerialPortID, ucInputMessage, MEDIUM_MESSAGE) which, as you know, returns: return ((que_ids[driver_id].CallAddress)(que_ids[driver_id].qHandle, input_buffer, nr_of_bytes, CALL_READ, driver_id));
 and here my code gets stuck, and nothing  happens after this instruction. My values are all non zero, apart from the que_ids[driver_id].qHandle which is 0.

33
I see.
So this is what I do:
+ in TaskConfig I have {"Y", fnMyTask, NO_QUE, (DELAY_LIMIT)(1 * SEC), UTASKER_STOP} that starts the task at the beginning.
+ Then, in my task I define the TTYTABLE for Tx and Rx, and I assign DebugHandle = SerialPortID; at this point I can write to UART.
+ Now, what I am trying to do but I don't know how, is to run the task again so I can enter a state where I can catch the UART Rx interrupt/messages. The task to wake in TTYTABLE, as I said in the other post, does not get triggerd so I don't even enter the routine containing the fnRead(SerialPortID, ucInputMessage, MEDIUM_MESSAGE).
I don't need something periodic, but something that waits for SERIAL interrupts. I was using the uTaskerMonoTimer (improperly)  to set the task in "listening for interrupts", that's why my task is periodically relaunched or does not receive UART interrupts

34
that's the configuration I use inside the task itself to wait for event to cause it to run again., not the configuration in TaskConfig.h.
If I use NO_QUEUE in uTaskerMonoTimer I get an error

35
µTasker general / Re: Are there UART received interrupts?
« on: May 12, 2020, 05:16:58 PM »
I fixed the fnMsg(SerialPort) and does not get stuck, in fact I get SerialPortID >0. But for some reason I still don't get the UART interrupt. When I configure my serial interface table, where in the code is it associated to the UART Rx interrrupt?

36
µTasker general / Re: Are there UART received interrupts?
« on: May 12, 2020, 04:56:19 PM »
I found part of the problem I think.
Functions such as fnMsgs(SerialPortID) or fnWrite(SerialPortID, (unsigned char *)ucRx, ucLength); get stuck, but I'm not sure how to solve this problem

37
µTasker general / Are there UART received interrupts?
« on: May 12, 2020, 03:37:05 PM »
Hi,

Is there something like a received UART interrupt in uTasker or how does it work? I mean I define my Serial configuration like this:

Code: [Select]
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_19200; // baud rate 19�200
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; // 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 + USE_XON_OFF + 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;

now, when I receive a new message my task should be waken up, but how does it actually happen? Is there an interrupt that makes uTasker execute my task or does it happen just because UART senses something? I'm trying to get to that point because I can transmit over UART but my task is not executed upon reception

Thank you

38
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


39
µTasker general / Re: Max number of new Tasks
« on: May 09, 2020, 05:17:56 PM »
Thanks Mark,

very helpful!

40
µ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

41
µTasker general / Re: SPI Slave config on KL03
« on: February 24, 2020, 03:21:48 PM »
Thank you Mark.

The structure is similar to what I thought, so this is very helpful. I worked with UART, as you might remember from my other posts, so this makes makes sense to me. I'll try it

42
µTasker general / Re: SPI Slave config on KL03
« on: February 21, 2020, 05:03:23 PM »
thanks Mark.

The guide is for I2C, but I guess I can do something similar for SPI.
Please correct me if I am wrong: I need to create a TABLE with SPI parameters, buffers, callback etc. Open the connection (fnOpen) that returns the PortID. And I need to define my callback to manage the received data.

I was expecting that part of this, such as the SPI_TABLE struct and the callback were already implemented or that I could use something similar to the SPI master config

Code: [Select]
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_0, SPI_CS1_0, (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;

43
µ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

44
µTasker general / Re: UART Tx/Rx in different pins for KL03
« on: January 11, 2020, 12:23:10 AM »
Hey Mark,
 
I see how the APPLICATION TASK uses the QUEUE_HANDLE fnSetNewSerialMode(unsigned char ucDriverMode) to set up the UART and if I change the task to wake in this function to TASK_MY_UART I can use my task upon receiving UART data.

However, all this works only if I keep HELLO_WORLD active.
I tried to have the same configs of hello_world and replicate a similar TTYTABLE with tInterfaceParameters.Task_to_wake = TASK_MY_UART  in my task, commented the HELLO_WORLD, but it doesn't work.

Any ideas why?

45
µTasker general / Re: UART Tx/Rx in different pins for KL03
« on: January 10, 2020, 06:34:56 PM »
Hi Mark,

I was able to make it work, my code works now as far as I keep the HELLO_WORLD activated

Pages: 1 2 [3] 4 5