cancel
Showing results for 
Search instead for 
Did you mean: 

SPWF04S python over SPI

Matteo Pezzoli
Associate II
Posted on May 18, 2017 at 15:35

Hi,

I have one question about the SPWF04S module python capabilities. Looking at the 'console_active' configuration variable, it seems that the python functionalities can be used only with the UART. Given that the command 'AT+S.PYTHON' has its SPI equivalent though, i would say that scripts can be launched via SPI, and the only thing that needs an UART to function is the REPL; is this correct?

Thank you

#spwf04sa
3 REPLIES 3
Posted on May 18, 2017 at 15:52

Ciao Matteo,

console_enabled (not console_active ) can be set from 0 to 3:

  • 0 and 1 -> interface is SPI or UART only. You cannot run AT+S.PYTHON, since REPL mode is intended only for UART;

  • 2 -> this is the UART+REPL mode. You can enter REPL (AT+S.PYTHON), or run a script (AT+S.PYTHON=script.py);

  • 3 -> interfaces are disabled over UART/SPI pins

Once inside the python REPL, or while executing a python script, we can use different and dedicated UART/SPI peripherals, over GPIOs alternate functions. Moreover, you can find I2C, ADC, DAC & PWM classes.

Summary:

  • Python is only available when

    console_

    enabled

    >=2
  • REPL is only available when

    console_

    enabled

    ==2
  • SPWF04S pins for communication interface (UART or SPI) are not GPIOs

  • Python peripherals (UART and SPI and others) are GPIOs (0 to 18)

Posted on May 19, 2017 at 08:56

Ciao Gerardo,

Thank you again. Do you know if there are any plans (even if not short-term) to implement python via SPI or the bus is just not fit for this application?

Posted on May 19, 2017 at 09:54

Ciao Matteo,

if with 'python via SPI' you mean 'REPL over SPI', no, there are no plans for some reasons:

  • REPL needs to be a plug&play. No protocols, headers, clocks, other. Just, plug in the board, and press some keys with your PC keyboard;
  • REPL I think will be never used in production. Your final product will never use the REPL. It's only a debug aid. Once  the script is completed/debugged, console_enabled will be set to 3

In a few works: there is no console_enabled meaning SPI+REPL mode