Jump to content
Sign in to follow this  
Antonio Pires

Novo Migration

Recommended Posts

I'm trying to convert an existing project to work with NOVO RTOS.

 

The project consists of two main files. One is the I2C network driver where I have a ISR to deal with I2C comms based protocol. In this ISR every time a frame is received it signals a semaphore using the SysSignalSemaphore function.

 

In the main file I have two tasks, one is simply a blink led control task which uses the sleep primitive. The other task is responsible for processing the I2C frame information already buffered. It waits for a semaphore (signalled by the ISR) and then process the I2C info and wait again for the semaphore.

 

The problem is that neither the tasks run.

 

I would like to know what can be happening.

 

Here are some extracts from the code:

 

ISR ( a separate module)

========================

 

void SLV_I2C_Handler(void)

{

................

 

if(stat_da && !stat_rw && !stat_bf)

{

LED_0 = OFF;

slv_stat.cmdrcvd = 1;

SysSignalSemaphoreIsr(hSemCmdRcv);

}

}

 

 

Main program

============

1) Includes

 

#include <system.h>

#include <stdio.h>

#include <novocfg_pic16t3e5ts1.h>

#include <novo.h>

#include "cpucfg.h"

#include "I2Cslv.h"

 

2) Tasks

 

// Novo RTOS

 

#define hTask0 0

#define hTask1 1

 

#define hSemCmdRcvd 0

 

void Task0(void)

{

 

unsigned int rawval;

while (1)

{

Sys_WaitSemaphore(hSemCmdRcvd, EVENT_NO_TIMEOUT);

 

switch (I2C_GetCmd(0))

{

 

case 0: // Read Temperature - Regs 0-1

rawval = hMeasureTemp();

I2C_SendDataWord(0, rawval);

break;

 

case 1: // Read Humidity - Regs 2-3

rawval = hMeasureHum();

I2C_SendDataWord(2, rawval);

break;

default: break;

}

 

Sys_Yield();

}

}

 

void Task1(void)

{

static bit lit=0;

 

while (1)

{

lit = ! lit;

portb.1 = lit;

Sys_Sleep(10);

Sys_Yield();

}

}

 

3) Main

 

void main(void)

{

 

 

InitHW();

hConnectionReset();

delay_ms(100);

 

InitTimer();

SysInit();

SysCreateTask(hTask0,2,Task0);

SysCreateTask(hTask1,2,Task1);

 

SysStartTask(hTask0);

SysStartTask(hTask1);

 

 

while (1)

{

Sys_Yield();

}

}

 

4) Interrupt vector

 

void interrupt( void )

{

 

 

// Handle SSP interrupt

 

if(sspif)

{

 

LED_0 = ON; // Turn on LED to indicate I2C activity.

sspif = 0; // Clear the interrupt flag.

SLV_I2C_Handler(); // Do I2C communication

 

}

 

// Handle Timer 1 interrupt

 

if (tmr1if)

{

 

tmr1if=0; // Clear Interrupt flag

SysTimerUpdate();

tmr1l = 0x2b; // 25 ms

tmr1h = 0xcf;

}

}

 

 

The projects compiles and links well without errors and I' using the appropriate libs.

 

Can you help?

 

Thank you.

Share this post


Link to post
Share on other sites
I'm trying to convert an existing project to work with NOVO RTOS.

 

The project consists of two main files. One is the I2C network driver where I have a ISR to deal with I2C comms based protocol. In this ISR every time a frame is received it signals a semaphore using the SysSignalSemaphore function.

 

In the main file I have two tasks, one is simply a blink led control task which uses the sleep primitive. The other task is responsible for processing the I2C frame information already buffered. It waits for a semaphore (signalled by the ISR) and then process the I2C info and wait again for the semaphore.

 

The problem is that neither the tasks run.

Do you use the linker command line option -swcs, this is required in order to use the software call stack that Novo RTOS needs.

 

Regards

Dave

Share this post


Link to post
Share on other sites
I'm trying to convert an existing project to work with NOVO RTOS.

 

The project consists of two main files. One is the I2C network driver where I have a ISR to deal with I2C comms based protocol. In this ISR every time a frame is received it signals a semaphore using the SysSignalSemaphore function.

 

In the main file I have two tasks, one is simply a blink led control task which uses the sleep primitive. The other task is responsible for processing the I2C frame information already buffered. It waits for a semaphore (signalled by the ISR) and then process the I2C info and wait again for the semaphore.

 

The problem is that neither the tasks run.

Do you use the linker command line option -swcs, this is required in order to use the software call stack that Novo RTOS needs.

 

Regards

Dave

 

I forgot that detail...sorry for wasting your time...It works fine now. Thanks Dave.

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...