Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Can't read lightlevel-sensor (tsl2550) #3

@aicastell

Description

@aicastell

Hello.

I'm working with a Jennic JN5148 on a jndevkit platform. I want to read lightlevel-sensor on the PCB board. To do that, I developed a very simple test (based on imu-serial.c).

include "contiki.h"

include "dev/temperature-sensor.h"

include "dev/lightlevel-sensor.h"

include "dev/leds.h"

include <stdio.h>

PROCESS(my_process, "My process");
AUTOSTART_PROCESSES(&my_process);
PROCESS_THREAD(my_process, ev, data)
{
static struct sensors_sensor *s;

PROCESS_BEGIN();

/* make sure that the sensor process is running! */
process_start(&sensors_process, NULL);
PROCESS_PAUSE();

printf("Activating sensors\r\n");

/* activate all sensors */
for (s=sensors_first(); s; s=sensors_next(s)) {
    printf("configuring...\r\n");
    if (s->configure(SENSORS_ACTIVE,1)) {
        printf("%s activated.\r\n", s->type);
    }
    else while (1) {
        PROCESS_YIELD();
        printf("%s not activated.\r\n", s->type);
    }
}

printf("While(1)...\r\n");

while(1)
{
    int a;

    PROCESS_YIELD_UNTIL(ev==sensors_event);
    s = (struct sensors_sensor*) data;

    if (s==&lightlevel_sensor) {
        a = s->value(LIGHT_VALUE_VISIBLE_CENTILUX);
        printf("lig:%d\n",a);
    }
}

PROCESS_END();

}

However, this test doesn't work. This is the output I get on the console debug:

Tentative link-local IPv6 address fe80:0000:0000:0000:fdff:ffff:ffff:ffff
Activating sensors
configuring...
reset due to watchdog
Tentative link-local IPv6 address fe80:0000:0000:0000:fdff:ffff:ffff:ffff
Activating sensors
configuring...
reset due to watchdog
Tentative link-local IPv6 address fe80:0000:0000:0000:fdff:ffff:ffff:ffff
Activating sensors
configuring...
reset due to watchdog
Tentative link-local IPv6 address fe80:0000:0000:0000:fdff:ffff:ffff:ffff
Activating sensors

At file contiki-main.c (jndevkit platform) there is a "AppColdStart" function that seems the main function, and starts a watchdog:

/* enable watchdog on JN5148, there is none on JN5139 */

ifdef BA2

watchdog_start();

endif

I suppose each time I call PROCESS_YIELD, contiki should reset that watchdog, but it seems not to work as expected.

Can some of you point to me in the right direction to solve this issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions