• 0 Votes
    9 Posts
    2k Views
    V
    @robert-hh Thank you. I will work on that advice.
  • UART wiring for Sipy to FOCA converter

    Getting Started sipy serial
    3
    0 Votes
    3 Posts
    1k Views
    robert-hhR
    @Vercellotti a) You must set Putty to "No flow control", 8 N 1 b) Try to exchange RX/TX. (RX to Rx, TX to TX). The labeling is sometimes swapped. c) And yes, you do not need DTR.
  • Downgrade SiPy firmware

    SiPy sipy sipy firmware sipy downgrade
    6
    0 Votes
    6 Posts
    2k Views
    S
    @livius As previous I intend SiPy-1.6.7.b1.tar I can post you the entire code, but this could be used only with our device connected to the UART serial port. Anyway, I post you the code used to handle sockets, because I suspect that the issue could be related to this task: import _thread import tracingfunction import time import socket import pycom # Global array for rx data from serial port SerialRxPacketsLock = _thread.allocate_lock() # this value define the max number of parallel socket! # Don't configure a value grather than the maximum allowable connections # on uart device!! (see the define MAX_SOCK_NUM in the uart device project) MaxNumActiveSockets = 6 # this arry is used by the task serialport to request a close on the relative socket KillRequestSocketList = bytearray(MaxNumActiveSockets) # this mutex is used to avoid thread conflicts in th access of the list of packets and socket SocketListLock = _thread.allocate_lock() # list of packets that must be sent on a particular socket rxPacketsFromSerialPortList = [] # list of enabled sockets socketList = [] # list of id related to the socket! socketUniqueIdList = bytearray(MaxNumActiveSockets) pycom.heartbeat(False) currentRGBLed = 0x007f00 # this function return the number of current active sockets def GetNumOfActiveSocketList(): global SocketListLock global socketList global MaxNumActiveSockets idx=0 totalActiveSocket=0 SocketListLock.acquire() while(idx<MaxNumActiveSockets): if(socketList[idx]!=None): totalActiveSocket=totalActiveSocket + 1 idx = idx + 1 SocketListLock.release() return totalActiveSocket # this function return the position of the first free socket slot def ObtainSocketListPosition(): global SocketListLock global MaxNumActiveSockets idx=0 SocketListLock.acquire() while(idx<MaxNumActiveSockets): if(socketList[idx]==None): break idx = idx + 1 if(idx==MaxNumActiveSockets): idx=-1 SocketListLock.release() return idx def toggleRGBLed(): global currentRGBLed if(currentRGBLed==0x007f00): currentRGBLed=0 else: currentRGBLed=0x007f00 pycom.rgbled(currentRGBLed) # socketThread # This task is responsible to handle data from/to the socket # ------------------------------------------------------------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------------------------------------------------------------ def socketThread(voidPar): import stuffingfunctions global socketList global SerialRxPacketsLock global rxPacketsFromSerialPortList global KillRequestSocketList # we print on the terminal that the thread started print ("socketThread Started") # set counters and ids to zero idxSocketToCheck = 0 aliveCounter = 0 pycom.rgbled(0x00007f) # infinite loop! while True: # increase the alive counter aliveCounter = aliveCounter + 1 # if the alive counter reachs 15000, print on the # terminal that this thread is alive if(aliveCounter>15000): aliveCounter = 0 print("socketThread alive!!") # assign the thread socket position threadIdPos = idxSocketToCheck # if there is a kill request, the buffer is empty and the socket is valid, close the socket if(KillRequestSocketList[threadIdPos]==1) and (socketList[threadIdPos]!=None) and (rxPacketsFromSerialPortList[threadIdPos]==None): socketList[threadIdPos].close() socketList[threadIdPos]=None KillRequestSocketList[threadIdPos]=0 print("Socket " + str(threadIdPos) + " killed!") # acquire the mutex SerialRxPacketsLock.acquire() if (socketList[threadIdPos]!=None): # if the current socket is alive if(rxPacketsFromSerialPortList[threadIdPos]==None): # if there is no data to send, do nothing pass else: # if there is data to send, try to send it try: print("Writing data into socket " + str(threadIdPos)) socketList[threadIdPos].send(rxPacketsFromSerialPortList[threadIdPos]) print("Write data ok") rxPacketsFromSerialPortList[threadIdPos]=None toggleRGBLed() # pycom.rgbled(0x007f00) except: # in case of exception, trace on file and close the socket print("Exception sending data " + str(threadIdPos)) tracingfunction.TraceLine("Exception sending data to the socket!") socketList[threadIdPos].close() socketList[threadIdPos]=None stuffingfunctions.WriteStuffingSerialPort(None, 0,threadIdPos, 1, socketUniqueIdList[threadIdPos]) rxPacketsFromSerialPortList[threadIdPos]=None else: # if the current socket is not alive, drop the data... rxPacketsFromSerialPortList[threadIdPos]=None # release the mutex SerialRxPacketsLock.release() if (socketList[threadIdPos]!=None): # if the current socket is alive # set partialData to None partialData=None while True: try: data=None #Receiving from client data = socketList[threadIdPos].recv(1460) if not data: # if we have not received anitying if (partialData!=None): # in this case, if we have partial data != none, the data is only in the partialData array data=partialData print("Received data from socket " + str(threadIdPos) + " Len: " + str(len(data))) stuffingfunctions.WriteStuffingSerialPort(data, len(data),threadIdPos, 0 , socketUniqueIdList[threadIdPos]) toggleRGBLed() # pycom.rgbled(0x00007f) break else: if(len(data)>0): # if we have received something if(len(data)==1024): # in this case, there are probably many bytes to read (python slices packets greather than 1024 in multiple packets) # we save this data in the partialData and we issue a new read request... partialData=data time.sleep(0.002) continue else: if (partialData!=None): # in this case, if we have partial data != none, we compose the full packet partialData = partialData + data data = partialData else: # in this case, the data is only in the data array pass # we pass the packet to the serial port! print("Received data from socket " + str(threadIdPos) + " Len: " + str(len(data))) stuffingfunctions.WriteStuffingSerialPort(data, len(data),threadIdPos, 0 , socketUniqueIdList[threadIdPos]) toggleRGBLed() # pycom.rgbled(0x00007f) break break except socket.timeout: if data: if(len(data)>0): # added 30/03/2017 10.17 -----> if (partialData!=None): # in this case, if we have partial data != none, we compose the full packet partialData = partialData + data data = partialData else: # in this case, the data is only in the data array pass # added 30/03/2017 10.17 <----- print("Received data from socket " + str(threadIdPos)) stuffingfunctions.WriteStuffingSerialPort(data, len(data),threadIdPos, 0 , socketUniqueIdList[threadIdPos]) toggleRGBLed() break except socket.error: # in case of error exception, we close the socket print("Closing socket thread " + str(threadIdPos)) if(socketList[threadIdPos]!=None): socketList[threadIdPos].close() socketList[threadIdPos]=None stuffingfunctions.WriteStuffingSerialPort(None, 0,threadIdPos, 1 , socketUniqueIdList[threadIdPos]) break # we increase the socket idx idxSocketToCheck = idxSocketToCheck + 1 # eache time we parse all sockets, we do a pause of 2 ms if idxSocketToCheck==MaxNumActiveSockets: idxSocketToCheck = 0 time.sleep(0.002) # we should never reach this point print ("ThreadRx " + str(threadIdPos) + " terminated!")
  • COMMUNICATION BY RS232

    SiPy sipy pymakr uart
    2
    0 Votes
    2 Posts
    1k Views
    L
    @julian-cifuentes look here it is simple https://docs.pycom.io/pycom_esp32/library/machine.UART.html and connect RX and TX to pins like in datasheet https://docs.pycom.io/pycom_esp32/pycom_esp32/datasheets.html RX to TX TX to RX and GND
  • 0 Votes
    6 Posts
    2k Views
    L
    @jmarcelino created https://github.com/pycom/pycom-micropython-sigfox/issues/1 and also pull https://github.com/pycom/pycom-micropython-sigfox/pull/2
  • 0 Votes
    3 Posts
    1k Views
    A
    The latest firmware, 1.6.12.b1 has fixed this issue for machine.reset(). Typing CTRL-D in Pymakr still causes a crash but that is manageable by testing for machine.SOFT_RESET before attempting to set up Sigfox and if true, do a machine.reset() or machine.deepsleep(1) first.
  • Deepsleep stops execution of main

    SiPy deepsleep sipy
    8
    1 Votes
    8 Posts
    3k Views
    G
    @jcaron - I don't really have the facility to capture the actual Wifi messaging, but this may highlight the issue. I'm not using any other radios and primarily using and external antenna, but tried the internal too. The WDT in the boot.py seems to be working well - been running for 24 hours and keeps reporting - previously rarely got more than an hour. I can see the WDT kicking in and doing it's job. I guess this is the sort of thing the WDT was designed for!! Thanks for your help.
  • Arduino > Sipy

    SiPy arduino sipy sigfox
    5
    0 Votes
    5 Posts
    2k Views
    J
    @jcleloup Yes, correct. The SiPy is not just a modem, it's also microcontroller and many times more powerful than the Arduino
  • Sipy -> Sigfox -> AWS

    SiPy sipy amazon aws
    8
    0 Votes
    8 Posts
    3k Views
    M
    @matt3526 DID anyone figure this out?
  • SigFox Error

    SiPy sipy sigfox
    16
    0 Votes
    16 Posts
    5k Views
    S
    @jmarcelino There u go the WIFI Autoconnect was still on !!!!! Now it works. Thank you guys !!!!!!!
  • Code stuck using sigfox with I2C sensor

    SiPy sigfox i2c sipy
    1
    0 Votes
    1 Posts
    948 Views
    No one has replied
  • Example Alarm fail

    SiPy alarm sipy example 1.8.6
    4
    1 Votes
    4 Posts
    1k Views
    robert-hhR
    @VST-Admin The actual example in the in the examples section documentation mentions alarm.callback(None). The recent firmware supports the cancel method. So I recommend updating the firmware.
  • Issues with UART(1) Port

    SiPy sipy
    2
    0 Votes
    2 Posts
    1k Views
    L
    @souldrone Do not use Pymakr it is unsupported - wait for plugin arrival. Now use e.g. Arduino IDE -> COM port monitor or Putty to read/write UART repl.
  • How to get acknowledgement when sending message?

    SiPy sipy socket sigfox network
    17
    0 Votes
    17 Posts
    6k Views
    D
    similar problem. this: sigfox = Sigfox(mode=Sigfox.SIGFOX, rcz=Sigfox.RCZ1) s = socket.socket(socket.AF_SIGFOX, socket.SOCK_RAW) s.setblocking(True) s.setsockopt(socket.SOL_SIGFOX, socket.SO_RX, True) s.send(bytes([0x00, scale(lux.light()[0]), 3, 4, 5, 6, 7, 8, 9, 10, 0xAA, 0xFF])) retval = s.recv(32) print ("received " + retval) gives me: Traceback (most recent call last): File "<stdin>", line 164, in <module> OSError: [Errno 100] ENETDOWN whilst the backend shows me: Status : [ACKED] Data (Hexa) : cafecafecafecafe any idea what i'm missing here? It's definitively not the link - sender and receiver have free LOS. avgSnr=20.74 rssi=-52.00 Used HW: FiPy on '1.17.5.b6'
  • SSL Connection IPProto_SEC Error SiPy

    Moved SiPy websocket sipy
    5
    0 Votes
    5 Posts
    2k Views
    L
    @livius Did a quick try. Got the following error: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/flash/lib/urequests.py", line 141, in urlopen File "/flash/lib/urequests.py", line 38, in __init__ OSError: -32512 Will look more into it later, but as fare as I can Google it might have something to do with the antenna transmission.
  • EXPORT CODE FROM ARDUINO TO PYMAKR

    Pymakr sipy pymakr micropython
    5
    0 Votes
    5 Posts
    3k Views
    C
    Take a look to an arduino like wrapper for pycom at https://github.com/dinosd/pyCom/blob/master/examples/arduino_sample.py import arduino estado = 0 estado2 = 0 cont = 0 A = 10 B = 11 C = 12 D = 13 E = 14 def setup(): arduino.pinMode(15, "ANALOG_INPUT") #PIN P15, there is no mode analog input in arduino but pycom needs it arduino.pinMode(8, "INPUT") # modes are "INPUT","OUTPUT","INPUT_PULLUP","INPUT_PULLDOWN","ANALOG_INPUT" arduino.pinMode(7, "INPUT") arduino.pinMode(A, "OUTPUT") arduino.pinMode(B, "OUTPUT") arduino.pinMode(C, "OUTPUT") arduino.pinMode(D, "OUTPUT") arduino.pinMode(E, "OUTPUT") def loop(): global estado, estado2, cont value = arduino.analogRead(13) millivolts = 1100 * value / 1.1 #max volts for analog in is 1.1V db = millivolts / 10 print(db, "DB") estado2 = arduino.digitalRead(8) if estado2: #this means high or you can write if estado2==1 estado = arduino.digitalRead(7) if estado: arduino.delay(500) cont += 1 if cont==1: arduino.digitalWrite(A, 1) arduino.digitalWrite(B, 1) arduino.digitalWrite(C, 1) arduino.digitalWrite(D, 1) arduino.digitalWrite(E, 1) setup() while True: loop()
  • Looking for general advices concerning usage

    Getting Started sipy serial
    10
    0 Votes
    10 Posts
    3k Views
    M
    Expansion board. Sry for late answers. Must wait 600s between different replies.
  • sigfox payload formatting

    SiPy sipy bytes
    5
    0 Votes
    5 Posts
    2k Views
    I
    @livius said in sigfox payload formatting: @iotmaker you can simply convert it b=[int(x, 16) for x in payload] but question is how do you got this payload? on first you have '0x11' but on last '4e' without 0x ? That worked... did some modification and now we are good. thank you
  • 0 Votes
    5 Posts
    2k Views
    L
    Thanks to Livius. That worked!