contiki | official git repository for Contiki , the open source OS
kandi X-RAY | contiki Summary
kandi X-RAY | contiki Summary
Contiki is an open source operating system that runs on tiny low-power microcontrollers and makes it possible to develop applications that make efficient use of the hardware while providing standardized low-power wireless communication for a range of hardware platforms. Contiki is used in numerous commercial and non-commercial systems, such as city sound monitoring, street lights, networked electrical power meters, industrial monitoring, radiation monitoring, construction site monitoring, alarm systems, remote house monitoring, and so on.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of contiki
contiki Key Features
contiki Examples and Code Snippets
Community Discussions
Trending Discussions on contiki
QUESTION
I am trying to remove a route in Contiki if attack is detected. I am using struct route_entry *e; route_remove(e);
But I am getting the following error: undefined reference to 'route_remove'
.
ANSWER
Answered 2022-Feb-15 at 07:32route_remove
is a Rime network stack function. By default, Contiki is built with uIP (IPv6) network stack, which does not have this function.
To remove a route when the IPv6 network stack is used, call this function:
void uip_ds6_route_rm (uip_ds6_route_t *route)
.
QUESTION
1)I am trying to drop only UDP packets in RPL in Contigi-ng OS.
I modified the code in/contiki/core/net/tcpip.c as:
ANSWER
Answered 2022-Feb-09 at 05:35You should change uip6.c in the "os/net/ipv6/uip6.c" path. please see this paper :A Reference Implementation for RPL Attacks Using Contiki-NG and COOJA. This is good reference for implementing attacks in Contiki-ng.
QUESTION
Consider an RPL network as shown in below. In this network node 1 is the root of the DODAG. Node 2 is the sender and sends unicast UDP packets toward receiver nodes (nodes 3-18). The DODAG is working in the non-storing mode and I am using Cooja mote of Contiki-NG to perform this simulation.
The problem is that the packets can only be reach to nodes that are placed up to 12 hops away (node 13 in this example). When the sender wants to send a packet for node 16 for example, we got the following warning by 6lowpan and the packet is dropped at the root: "Not enough packetbuf space to compress header (112 bytes, 92 left). Aborting." (line #706 sicslowpan.c)
I investigated the problem and found that the root creates the source routing header correctly and the header is added to the packet without any problem. However, the problem comes from the MAC layer and radio interface. The packet is larger than MAX_PAYLOAD_LEN
of radio driver. So the radio driver cannot handle the packet. The Contiki-ng has the nullradio driver by itself, but I think the radio driver and its parameters is defined by the platform. I need to mitigate this limitation. Is it possible to modify the parameters in Cooja mote source code? If yes how I can do that?
ANSWER
Answered 2021-Dec-16 at 08:18There are at least two, potentially three buffer size bottlenecks that determine the max size of a packet that can be send and processed with Contiki-NG network stack; three
The size of the radio's packet buffer. This is normally determined by the hardware of the radio, and normally can be read by asking for
RADIO_CONST_MAX_PAYLOAD_LEN
parameter of theNETSTACK_RADIO
driver.The size of the packet buffer. This is by default 125 bytes - small enough to fit in the payload of a standard IEEE 802.15.4 packet (for which the max PHY layer payload is 127 bytes) when a 2 byte FCS is added. The packetbuf size can be changed by the defining a different value of
PACKETBUF_CONF_SIZE
.If you use IPv6, then also the size of the uIP buffer. This is defined as
UIP_CONF_BUFFER_SIZE
and is by default quite large (1280 bytes) to be compatible with the IPv6 MTU defined by the relevant RFCs. However, some platforms set it a smaller value to save memory.
If you use simulated Cooja nodes, then the radio packet's buffer can be changed in software, by defining a different COOJA_RADIO_CONF_BUFSIZE
value in the project-conf.h
or in the Makefile. The default value is 125 bytes (so that when 2 byte FCS is added, the size is the max PHY layer payload of an IEEE 802.15.4 radio).
To solve your problem on Cooja you can try adding in project-conf.h
:
QUESTION
Im currently developing a low power IoT node based on Contiki-ng running on a TI CC1350 launchpad board. My problem is that my power consumption is always >6mA.
Compiling and running the energest
example I can see the MCU radio is always listening, no matter if I compile with MAKE_MAC = MAKE_MAC_NULLMAC
and MAKE_NET = MAKE_NET_NULLNET
. Running
MAKE_MAC = MAKE_MAC_TSCH
or MAKE_MAC = MAKE_MAC_CSMA
increases consumption by around 2mA as the CPU is always active, but the radio is never duty cycled.
Is there a way of reducing current consumption for Contiki-ng on this platform?
...ANSWER
Answered 2021-Aug-06 at 13:14With Contiki-NG, you have two options:
- Use CSMA or NullMAC and turn off the radio from the application code with
NETSTACK_RADIO.off()
. - Use TSCH and make sure the schedule has some idle slots. The radio is going to turn off automatically once the node has joined a TSCH network.
If you the latter, still see big consumption, and you're sure about your code, submit an issue to the Contiki-NG git - there can be an energy consumption bug in the OS specific to the CC1350 board.
QUESTION
I'm doing a project in Contiki to a Zolertia module where I need to calculate the risk of a wildfire to occur.
To calculate this risk the formula used is Risk = Temperature / Humidity
.
The result of Risk it's a decimal value and there are 5 different values range to classify this Risk: 0-0.49 , 0.5-0.99, 1-1.49, 1.5-1.99, >=2
.
My problem is that I can't get decimal results. When I run it in the terminal it shows the value of Temperature and the value of Humidity but just a blank space in the value of Risk.
My code is:
...ANSWER
Answered 2021-Jul-09 at 02:18I have a few suggestions:
- Specify the literals with either a trailing 'f' or add a decimal place in
temp = rand() % 45; hum = rand() % (85-5)+5;
- Declare temp and hum as floats and then cast the result of rand()
QUESTION
is it possible to call a web service from cooja? May be I can read from border-router then call web service (via python script for example). I can ping border-router but I dont know how to read from node or write to node in cooja.I am new to contiki-ng and cooja. thanks in advance
...ANSWER
Answered 2021-Apr-09 at 12:26You can try the websense example at the folder ~/contiki/examples/ipv6/sky-websense
QUESTION
So I tried to follow an example from: Fixed Point Arithmetic in C Programming, but I get the following error left shift count >= width of type
.
I did find others having this issue here on stackoverflow but I don't understand this error?
...ANSWER
Answered 2021-Apr-06 at 16:24The example in the question you link to is written for a C implementation in which int
is 32 bits. In the C implementation you are using, the int
type appears to be 16 bits, and this is too short for 16-bit shifts. You will need to adjust the code to use shorter shifts or a wider integer type.
Each integer type has a width, which is the number of bits used to represent it, including a sign bit (if the type is signed) and the value bits but excluding padding bits.
The error message “left shift count >= width of type” says amount of the left shift is greater than or equal to the width of the integer type you are shifting. For example, if you shift a 16-bit number 16 bits left, you shift all bits out of the integer, and there are none left. The C standard essentially treats this as overflow: It does not define the behavior. So the compiler is warning you.
Since the code in the question does not exactly match the error messages in the question, we cannot be sure, but one possibility is you are compiling for target in which the int
type is 16 bits wide, so the SHIFT_AMOUNT
of 16 bits is too much. Note that shifting an int
is also problematic because of the sign bit and how shifts of signed integers are defined in the C standard. It is usually preferable to use an unsigned type when shifting.
Possible remedies include:
- Check your shift amount. Using 16 for a 16-bit
int
results in a somewhat extreme fixed-point type. You may want a smaller shift amount. - Use a larger integer type, perhaps
long
. - Use a wider type for the shift and convert back. For example, if
long
is 32 bits, you could defineSHIFT_MASK
to be((int) ((1l << SHIFT_AMOUNT) - 1))
. - If
SHIFT_AMOUNT
is known to be at least one, but not more than 16, then avoid exceeding the width of the type by using a shorter shift with a left operand already shifted a bit:((2 << SHIFT_AMOUNT-1) - 1)
. - Split the operation into two shifts:
((1 << SHIFT_AMOUNT/2 << SHIFT_AMOUNT-SHIFT_AMOUNT/2) - 1)
.
Note the above options do not deal with the signedness issue. You would need to clarify the context for further advice on that.
QUESTION
I'm using RPL in Contiki 3.0 and I need to make some calculations where the results are float. But instead of giving me the result in float, it is only calculating the integer number for example: 5/2 = 2.0 instead of 2.5. How can I get the right answer? I can not print float or double in Contiki 3.0 so I'm using this code to convert float into a string:
...ANSWER
Answered 2021-Mar-30 at 13:50Because 5/2 is a form of integer division, what you put in you get out, meaning that if you put in 5/2 you will only get an integer back, in the form of 2.
To fix this, make your 5/2 is 5/2.0 so that it is read in as a float, and that will make sure that you will get an answer that is a floating-point decimal.
QUESTION
How does contiki os map an IP address to a MAC address, and where is this stored?
I know the basics of ICMPv6 and RPL but once the network is built, when sending an IPv6 packet, how is the MAC address of the next hop known? I assume that a Neighbor Solicitation message is not sent every time. Also, on Cooja, the only ICMPv6 messages I see are RPL messages.
I tried to find the answer by grep, google search and in the doc but I couldn't find it.
...ANSWER
Answered 2021-Mar-19 at 08:43There is a uIP neighbor data structure called uip_ds6_nbr_t
. These structures are kept in Contiki neighbor tables. When the mapping from an IPv6 address to a MAC address is needed, the code first calls uip_ds6_nbr_lookup(ipv6_address)
to find the neighbor, then uses the neighbor to find the link-layer address, by calling the function uip_ds6_nbr_get_ll(nbr)
.
QUESTION
Im trying to run code that was written for contiki3.x on contiki-ng, I get a compilation error stating undefined reference to `rpl_set_root', eventhough I include "net/routing/rpl-classic/rpl.h". Wen i open the source code rpl-classic/rpl.h and rpl-classic/rpl.c i can see the dunction clearly being there
The following code produces the compilation error.
uip_ds6_addr_add(&ipaddr, 0, ADDR_MANUAL);
...ANSWER
Answered 2021-Mar-16 at 14:56By default Contiki-NG has RPL-lite enabled, which does not have this function.
To switch to RPL classic, add this line to application's Makefile:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install contiki
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page