SiPy - No serial output, responds to console commands



  • The last couple of days my sipys has been really close to leaving this world for good.
    Transferring files via FTP, AFTER hooking up on sipy wifi is not cool, but I'll live. Sipy not being able to offer any serial output is really not cool.
    I tried numerous serial monitors in both PyMakr, Arduino IDE, Putty and others. None of these monitors shows any output.
    The sipy responds to commands via serial monitor uch as "os.uname().release" which is "1.6.3.b1" btw.
    Is there some known bugs in the new firmware that has not been found and/or communicated? Or did anyone out there find a viable method on how to make working with the Sipy bearable?
    Also, Filezilla shows my only two files, "boot.py" and "main.py" and three empty folders? If any of you got it running in a tolerable manner would you mind posting the proper file/folderstructure as seen from the FTP-client?

    Best, mathias.



  • I know this is very old and by now you may have caught it, but your if loop will always execute. The line

    if mac=='665544332211' or '111111111111': 
        <do stuff>
    

    is interpreted as

    if (mac == '665544332211') or ('111111111111')
    

    This always evaluates as True, because bool('111111111111') is True. I believe the only string that can evaluate to False is the empty string.

    This may be part of your problem. What you need is something like

    if (mac == '665544332211') or (mac == '111111111111')
    

    And if it's a larger list then you can do something like

    if mac in ['665544332211', '111111111111', ...]


  • My sipy is still dysfunctional.
    I can connect via FTP and upload file. Check.
    I can open a serial monitor and write commands. Check.
    But I can't get any output.
    View from arduino serial monitor:

    >>> print("h")
    h
    >>> ets Jun  8 2016 00:22:57
    
    rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0x00
    clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
    mode:QIO, clock div:2
    load:0x3fff9010,len:8
    load:0x3fff9018,len:248
    load:0x40078000,len:4056
    load:0x4009fc00,len:920
    entry 0x4009fde4
    I (1575) wifi: wifi firmware version: 2a22b2d
    I (1591) wifi: pp_task_hdl : 3ffd6b34, prio:23, stack:8192
    I (1591) wifi: Init lldesc rx mblock:10
    I (1591) wifi: Init lldesc rx ampdu len mblock:7
    I (1593) wifi: Init lldesc rx ampdu entry mblock:4
    I (1598) wifi: sleep disable
    I (2586) wifi: frc2_timer_task_hdl:3ffdcb84, prio:22, stack:2048
    I (2603) wifi: mode : softAP (24:0a:c4:00:f8:9d)
    MicroPython v1.8.6-480-g4e970fe3 on 2017-02-26; SiPy with ESP32
    Type "help()" for more information.
    >>> 
    

    with a file like this:

    #code block 
    
    
    import pycom
    import os
    os.uname()
    pycom.heartbeat(False)
    for cycles in range(10): # stop after 10 cycles
         print("loop")
    
    
    
    import binascii
    import socket
    import machine
    from network import Bluetooth
    from network import Sigfox
    from machine import Timer
    #import time
    print("go")
    #initialiser SigFox
    sig = 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,  False)
    rtc = machine.RTC()
    bluetooth = Bluetooth()
    timeCounter = Timer.Chrono()
    bluetooth.start_scan(-1)
    timeCounter.start()
    while bluetooth.isscanning():
        adv = bluetooth.get_adv()
        if adv:
            print(adv)
            mac = adv[0]
            mac = binascii.hexlify(mac)
            mac = mac.decode()
            if mac=='665544332211' or '111111111111': 
                print(adv)
                data = binascii.hexlify(adv[4])
                data = data.decode()
                timeElapsed = timeCounter.read()
                timeElapsed = round(timeElapsed, 3)
                print(data[24], data[25], data[28], data[29], timeElapsed)
                stringToSend =""
                stringToSend +=str(data[24])
                stringToSend +=str(data[25])
                stringToSend +=str(data[28])
                stringToSend +=str(data[29])
                stringToSend +=str(timeElapsed)
                print(stringToSend)
                s.send(stringToSend)
                s.settimeout(60)
                s.recv(32)
    

    The code is sending to the sigfox backend. So it's executing well enough.
    Hope you can see some obvious thing I've missed.



  • @maku
    That code does print HELLO to the serial output for me on SiPy 1.6.3b1.

    Can you describe your serial setup? Are you using the Pycom expansion board for that?
    Is you serial monitor set to the correct port and to 115200 bps?

    Can you see the debugging output on the serial console when the SiPy boots up?



  • @jmarcelino Via Filezilla I uploaded boot.py and main.py. I downloaded both files again to ensure that they are fine.
    boot.py:

    boot.py -- run on boot-up

    import os
    from machine import UART
    uart = UART(0, 115200)
    os.dupterm(uart)

    main.py:
    import pycom
    import time
    pycom.heartbeat(False)
    for cycles in range(10): # stop after 10 cycles
    pycom.rgbled(0x007f00)
    time.sleep(5)
    pycom.rgbled(0x127f00)
    time.sleep(5)
    pycom.rgbled(0x7f7f00)
    time.sleep(5)
    pycom.rgbled(0x7f0000)
    time.sleep(5)
    pycom.rgbled(0xffffff)
    time.sleep(5)
    print("HELLO")

    I would expect to see the Sipy printing "HELLO" in either Pymakr or any other serialmonitor.
    Is that a faulty asumption?
    The board is running main.py.



  • Sorry this isn't making sense to me, you say the SiPy doesn't offer any serial output but then also say it responds to commands via the serial monitor.

    Can you clarify what are you doing and expecting to happen ?


Log in to reply
 

Pycom on Twitter