Are parameters for spi, pin_cs and pin_rst necessary on Wiznet5K Pico - micropython

I have a Wiznet 5100S Pico on which I installed W5100S_EVB_PICO-20220618-v1.19.1.uf2 from the micropython site.
I wrote a small routine for my Wiznet 5100S Pico in Thonny, neglecting to add parameters when I initialized it.
import network
import socket
from machine import Pin
import time
import config
nic = network.WIZNET5K()
The routine runs fine. But it's time to expand it, so I created a new project in PyCharm. Now the code checker is warning me that I'm missing parameters in the nic = network.WIZNET5K() line.
Just wondering if this is an issue or did Micropython cover adding the proper parameters in their firmware for this model?

Related

Buildroot ir remote using ir-keytable or lirc

I created an image for raspberry pi zero 2 w using buildroot,
Also added overlay gpio-ir in config.txt but not able to receive ir signal.
No logs are printed for gpio in dmesg.
No devices are showing in /proc/bus/input/devices
Can anyone help?
I found solution my self.
Actually buildroot is not start gpio-ir-recv module at boot time.
So we need to load module manually at boot time.
We can load module by this command
modprobe gpio-ir-recv
So i have created one service to load module in /etc/init.d

How to make HTTP request with MicroPython on Arduino Nano Connect RP2040

I'm trying to connect my Arduino Nano RP2040 with MicroPython to my local WiFi network and make a HTTP request.
The Nina W102 uBlox module on the board is an ESP32 and connects to the RP2040 via SPI (I'm not sure what this means but I thought it might be relevant).
I've found this code snippet that seems to do what I want
def do_connect():
import network
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
if not wlan.isconnected():
print('connecting to network...')
wlan.connect('SKYNET', 'G1V31NT3RN3T')
while not wlan.isconnected():
pass
print('network config:', wlan.ifconfig())
do_connect()
But it breaks with:
Traceback (most recent call last): File "", line 1, in
ImportError: no module named 'network'
Im using Thonny as an editor and tried to search their packages for something called "Network" and found a match. But that gives me the below error/warning.
Any help or tips greatly appreciated.
UPDATE 1: Found this example with WiFi using CircuitPython. Would prefer to use MicroPython, but if all else fails I might have to switch firmwares.
https://learn.adafruit.com/circuitpython-on-the-arduino-nano-rp2040-connect/wifi
UPDATE 2: Opted to use CircuitPython. Getting WiFi was then quite easy.
Raspberry Pi Pico does not have any network capability.
Your provided code looks like from micropython for chips, that has wifi inside (ESP family, some others)
Looks like Arduino RP2040 board has wifi option, but via Nina W102 uBlox, using SPI, witch is ESP32 under the hood. Probably, Nina's firmware is to provide WIFI/BLE and being controlled via SPI.
I assume, Adafruit wrote circuitpython driver to control Nina chip. My wild guess is that Nina uses AT+ commands. Sometimes circuityphons libs works on micropython. If that is not the case this time- you need network driver for it. Quick search did not gave me any result.
Conclusion- use Circuipython or write/find driver for Nina on Micropython

How to setup STM32f103c8T Bluepill + Platformio + UART the right way?

I've been trying to figure out how to upload a code to a STM32103c8T bulepill board.
My setup is
1- MacOs Catalina
2- STM32103c8T bulepill board
3- SLAB UART USB-TTL CP2012 V3.0
4- Platformio IDE
5- STM32 CUBE Programmer software which detects and connects to my board through UART.
meaning that It has no problem connecting but there are issue with setting up the Platformio
BTW I am new to the ARM world and I bought this board to examine its speed and deep sleep and interrupt, I mean all the things that an Arduino Uno can't do.
The thing is I have no idea on how to setup the platformio.ini File to comunicate with the board
using the UART method and not requesting ST-link dongle!
What I have now in Platformio.ini is:
[env:bluepill_f103c8]
platform = ststm32
board = bluepill_f103c8
framework = arduino
upload_protocol = stlink
upload_port = tty.slab_usbtoUART
and when trying to upload the program i get:
Uploading .pio/build/bluepill_f103c8/firmware.elf
xPack OpenOCD, x86_64 Open On-Chip Debugger 0.10.0+dev-00378-ge5be992df (2020-06-26-12:31)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
debug_level: 1
hla_swd
none separate
Error: open failed
in procedure 'program'
OpenOCD init failed
shutdown command invoked
[upload] Error 1
I just need help getting the system talk to each-other and see each-other
P.S.
I want to go as bareMetal as possible and not to use arduino firmware HAL
You can use the following configurations:
upload_protocol = serial
upload_port = COMX/ttyx //whichever applies

How do I get Robotframework (in Eclipse) to respond to terminal prompt

I'm currently running Robotframework in Eclipse on Windows 10 OS. I'm using an external python library that allows students and teachers to use this extracted library to connect to our hardware devices. I'm automating the extractions from the main site package made by our developers. If more than one device is plugged into the USB ports on the PC, then the code does the following:
x = input("Select one device:")
selected = int(x)
This causes a terminal prompt so the user has to type in a 0, or 1 for example, then hit the ENTER key. User response will allow the code to further process a connect to the selected device. Note, this prompt is not a GUI. So when I run Robotframework, it will execute the steps up to the point where it's prompting.
It seems like this should be pretty easy, but I can't seem to figure it out. Since you're inside a piece of code that's waiting for input, how do you make RobotFramework do something with it?
Edit: It occurs to me that maybe there's a way to execute a delayed Robotframework step that starts an external python command after a specified time, to throw a '0' and a RETURN key response. I had a python file made from an import of pynput.py library which appears to work from the command line execution (prints a 0, or a 1, and a return line feed). There's gotta be an easier way I'd think, but I don't know what it is.
Edit: Can I run a keyword from a listener that watches for the command prompt and the keyword runs another python file to feed the prompt? If I get this to work, then all I have to do is leave the devices on the USB port (or hub for that matter), and select the devices I want to do further testing on. Our devices are supported Blooth tooth as well but I need to run both USB and BLE tests to verify our Python extractions the teachers and students can use.
Edit: The other option is to use a software programmable hub and select the USB with a specific device on it, but I'm trying to avoid that.
OK, I solved it using Robotframework background process. I wrote a small python file that gets executed from the process. It has a 5 second timer (more than I need) and then Robotframework runs the next Test Case step. The Python file then does some keyboard presses, selecting the port and an ENTER key which goes out to the console (feeding the input prompt). It connects the sensor.
So in my Robotframework Test Case I do the following:
*** Test Case ***
smoke_test
Start process . Python . usbportselect
open usb
The Python program called from the process looks like this:
import time
import pynput
from pynput.keyboard import Key, Controller
keyboard = Controller()
def choose_usb(portvalue)
keyboard.press(portvalue)
keyboard.release(portvalue)
keyboard.press(Key.enter)
keyboard.release(Key.enter)
time.sleep(5)
choose_usb('0')
Note: I'm pretty sure this won't fix all the problems with using processes, but it's at least a start and a way to feed input to a prompt resulted from a future Test Case step

Trying to Get a Raspberry Pi 3 to write and modify Data in a PostgreSQL database on a seperate Server

As a side project I have been interested in energy consumption. I have written and executed a program on a raspberry pi 3; this uses external hardware to gather data over Ethernet using ModbusTCP.
Within my program that is a data logging feature that creates and saves a CSV file with the values collected for that day. Every day at midnight a new CSV file is created and marked with the new day's date. This CSV file is saved locally on the raspberry pi and as it runs headless I’ve had to set up a cronjob to move the files onto a Thumb drive to allow me to view and assess the CSV file.
The modification I am trying to attempt is: I currently have a PostgreSQL database on a separate server; I am trying to get the Raspberry Pi to connect to the database and populate it with data as soon as the Pi has recorded it.
I have searched the internet, both this site and many others, but most of what I have found is tutorials and guides on how to set the Raspberry Pi up as a PostgreSQL server, which is not what I want to achieve.
Any advice and help is greatly appreciated.
Carl
Update : the programming language i am using is python 3
I would investigate using ssh. You can transfer the csv, and then invoke a script on the target machine, wait for a cron or just call pgctl at the remote command line. That will avoid the necessity of setting up a client on the PI, and opening the firewall at port 5432, configuring pg_hba.conf, etc.