# Devicetree error:

**URL:** <https://forum.sierrawireless.com/t/devicetree-error/8929>\
**Category:** ALEOS Application Framework\
**Created:** [November 28, 2016, 8:00pm UTC](https://forum.sierrawireless.com/t/devicetree-error/8929 "2016-11-28T20:00:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mjmurton1](https://avatars.discourse-cdn.com/v4/letter/m/ecd19e/32.png) [@mjmurton1](https://forum.sierrawireless.com/u/mjmurton1)\
**Post date:** [November 28, 2016, 8:00pm UTC](https://forum.sierrawireless.com/t/devicetree-error/8929/1 "2016-11-28T20:00:56Z")

</div>

local NET\_STATE = ‘system.aleos.cellular.state’  
print(NET\_STATE)  
local ok, msg = pcall(function()  
local result = devicetree.init()  
print(result)  
end  
)  
print(ok)  
print(msg)

local ok1, msg1 = pcall(function()  
local networkState = devicetree.get(NET\_STATE)

print(‘msg:’…networkState)  
end

)

print (ok1)  
print(msg1)

–[[print “main started” to the console everytime main runs]]–  
print(“main started”)

–[[The above code issues the following console output]]–  
system.aleos.cellular.state  
table: 0x19479f8  
true  
nil  
false  
attempt to yield across metamethod/C-call boundary  
main started

WHY AM I RECIEVING “attempt to yield across metamethod/C-call boundary” error?  
I am running this code on Aleos application framework 4.5.2 on a raven rv50. The devicetree seems to initialize, what would possibly stop a get call to a valid devicetree address?

Thank you,

MJMurton

---

<div class="post-metadata">

**Author:** ![cbugot](https://avatars.discourse-cdn.com/v4/letter/c/c37758/32.png) [@cbugot](https://forum.sierrawireless.com/u/cbugot)\
**Post date:** [November 29, 2016, 8:32am UTC](https://forum.sierrawireless.com/t/devicetree-error/8929/2 "2016-11-29T08:32:26Z")

</div>

devicetree API internally uses sockets and thus ‘yield’ (i.e. block), when waiting for data on the socket (until the data arrives). In Lua 5.1 there is a limitation that is you cannot yield across a C method. pcall is a C method (Lua API implemented in C).  
For this reason an yield compatible pcall is provided.

In your code please do  
require ‘coxpcall’

then replace pcall() by copcall() (same prototype)

More info on this here: [keplerproject.github.io/coxpcall/](http://keplerproject.github.io/coxpcall/)
