jandls
Posts
-
Coulomb counting for primary battery? -
How to access the micro-SD card on F1 starter kit?It would be good if the documentation provided some more information on this hard coding that is done for the F1 starter kit, but that does not apply when the F1 is put on a custom board. There must still be other things that are hardcoded to make the F1 starter kit work, because when I try the following, it doesn’t work:
>>> import machine, os >>> sd = machine.SDCard(slot=3, sck=42, miso=41, mosi=40) >>> os.mount(sd, '/sd') Traceback (most recent call last): File "<stdin>", line 1, in <module> OSError: 16The code that you gave works fine:
>>> import machine >>> sd = machine.SDCard() >>> os.mount(sd, '/sd') >>> os.listdir('/sd') ['System Volume Information', 'rain.csv', 'sensor.csv', 'waterlevel.csv'] -
How to access the micro-SD card on F1 starter kit?Thanks very much! Yes, this works. In this way we are using the SPI protocol with only sck, miso and mosi connected (to GPIO42, 41 and 40, respectively).
-
Coulomb counting for primary battery?When using a primary battery (non-rechargeable) like a lithium thionyl chloride battery, monitoring voltage to assess the % remaining capacity of the battery does not work well (very flat relationship between voltage and % remaining capacity). Coulomb-counting would be handy. The TI bq27441-G1 battery fuel gauge on the F1 starter kit is designed for rechargeable batteries and requires complicated calibration for the specific battery you want to use. But it does Coulomb counting. And TI says in this document link text that the bq27x00 could be used to assess the remaining capacity of primary batteries with Coulomb counting. Any information on how to do this? And are there any example scripts (or library?) for doing the I2C communication?
And what is the preferred option for sensing the battery voltage? By measuring voltage on GPIO12 that is connected to the voltage divider (two 100k resistors in series, but what tolerance?)? Or by querying the bq27441-G1 that also senses battery voltage?
-
How to access the micro-SD card on F1 starter kit?I tried to access the micro-SD card with the following script:
import machine from machine import Pin sd = machine.SDCard(slot=1, width=4, sck=Pin(42), cmd=Pin(40), data=(Pin(41), Pin(18), Pin(17), Pin(16)), freq=20000000)But that gives the following error:
>>> sd = machine.SDCard(slot=1, width=4, sck=Pin(42), cmd=Pin(40), data=(Pin(41), Pin(18), Pin(17), Pin(16)), freq=20000000) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: extra keyword arguments given`Also this does not work:
>>> sd = machine.SDCard(slot=1, width=4, sck=42, cmd=40, data=(41, 18, 17, 16), freq=20000000) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: extra keyword arguments givenFrom the schematic, I can see that the micro-SD card reader is connected as follows:
CLK >> GPIO42
CMD >> GPIO40
DAT0 >> GPIO41
DAT1 >> GPIO18
DAT2 >> GPIO17
DAT3 >> GPIO16Is that correct?
From the explanation on link text I learned that for ESP32-S3 and using SD/MMC mode, slot 1 allows for the use of 4 data pins (width=4). Correct? -
Wake up (from Deep sleep) example in documentationCould it be that there are some errors in the example script in the documentation available at link:
import machine import time wake_reason = machine.wake_reason() print("Device running for: " + str(time.ticks_ms()) + "ms") if wake_reason == machine.PWRON_RESET: print("Woke up by reset button") elif wake_reason == machine.PIN_WAKE: print("Woke up by external pin (external interrupt)") elif wake_reason == machine.ULP_WAKE: print("Woke up by ULP (capacitive touch)") elif wake_reason == machine.TOUCHPAD_WAKE: print("Woke up by touchpad") machine.deepsleep(1000*60) #sleep for 1 minute print("This will never be printed")I think there is some mixup between machine.wake_reason() and machine.reset_cause().
When the F1 is woken up from deep sleep because the reset button is pressed, the wake_reason=0 and reset_cause=1
When the F1 is woken up from deep sleep by an external pin (wake_on_ext0), the wake_reason=2 and reset_cause=4
And since the constant machine.PWRON_RESET=2, this script will give the message “Woke up by reset button” when it was actually woken up by an external pin. And when it is woken up by the reset button, it will not produce a message. Because in that case wake_reason=0, so it fulfils none of the if conditions.The meaning of machine.wake_reason() and machine.reset_cause() codes (and the definition of the constants) can be obtained by:
>>> import machine >>> help(machine) object <module 'umachine'> is of type module __name__ -- umachine mem8 -- <8-bit memory> mem16 -- <16-bit memory> mem32 -- <32-bit memory> freq -- <function> reset -- <function> (I dropped some lines here) reset_cause -- <function> HARD_RESET -- 2 PWRON_RESET -- 1 WDT_RESET -- 3 DEEPSLEEP_RESET -- 4 SOFT_RESET -- 5 wake_reason -- <function> PIN_WAKE -- 2 EXT0_WAKE -- 2 EXT1_WAKE -- 3 TIMER_WAKE -- 4 TOUCHPAD_WAKE -- 5 ULP_WAKE -- 6 >>>I also do not understand why the example script reads as:
elif wake_reason == machine.ULP_WAKE: print("Woke up by ULP (capacitive touch)")I would think that when the F1 is woken up by the ULP, that has nothing to do with ‘capacitive touch’. Or do I get it wrong?
-
Schematic of Starter Kit board and details of QWIIC and 1mm pitch battery connectorsThanks very much!
-
1NCE sim card: how can I register it under my name on the 1NCE portal?OK, thanks.
-
LTE Mode check (and switching) not possible in PPP mode?OK, thanks. That means I need to use lte.pppsuspend() before using these commands (and lte.pppresume afterwards)?
-
Which machine commands are available?OK, thanks. This is good to know.
-
Possible to save and restore the LoRaWAN state (joined status, network keys, packet counters, etc) to/from non-volatile memory?OK, excellent. Thanks!
-
Wrong link in documentation -
1NCE sim card: how can I register it under my name on the 1NCE portal?How can I register the 1NCE sim card under my name on the 1NCE portal, so I can see data usage and top it up as needed?
-
Schematic of Starter Kit board and details of QWIIC and 1mm pitch battery connectorsWould it be possible to have the schematic of the starter kit board? Without that, it is difficult to know how the microSD card slot, the QWIIC connector, the jumper switches, the 1mm pitch battery connector, etc. are connected. Also, information is needed on the specifications of QWIIC and 1mm pitch battery connectors, so one can buy the right components to connect to these. The schematic would also greatly speed up the design of new applications that integrate the F1 module. Such designs may also need a battery charger, a ‘fuel gauge’ for the battery, a microSD card slot etc.
Basically, at the moment the hardware part shown below provides very little information on all this when clicking on the ‘hardware’ link:

-
Which machine commands are available?Which machine commands are available? Some of these commands are processor-specific. In the documentation so far, I can see Pin, ADC, I2C. Where to find the specifics for the F1?
-
Possible to save and restore the LoRaWAN state (joined status, network keys, packet counters, etc) to/from non-volatile memory?The pycom boards had commands to save and restore the LoRaWAN state (joined status, network keys, packet counters, etc) to/from non-volatile memory with lora.nvram_save() and lora.nvram_restore(). This was handy to keep that information over the deepsleep cycle and save time (and power) when the module awakens. Is this also possible on the F1? How?
-
LTE Mode check (and switching) not possible in PPP mode?I am trying to follow the documentation that proposes the following to check the LTE Mode :
from LTE import LTE lte = LTE() lte_mode = lte.mode() # Return current mode if lte_mode == LTE.CATM1: print(‘Modem is in CAT-M1 mode!’) if lte_mode == LTE.NBIOT: print(‘Modem is in NB-IoT mode!’)However, when I try the mode checking, I get the following:
>>> lte = LTE() >>> lte.mode() 0I believe the value 0 indicates that the LTE module is in idle mode. Is that correct?
So next I attach and I connect, and then try the lte.mode() command again. By the way, it seems double quotes are needed for “iot.1nce.net”. The single quotes in the documentation do not work. This is what now happens:>>> lte.attach(apn="iot.1nce.net") >>> lte.isattached() True >>> lte.connect() >>> lte.isconnected() True >>> lte.mode() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "LTE.py", line 312, in mode File "LTE.py", line 472, in check_ppp OSError: Operation not possible while in PPP mode!Any solution? What is this PPP mode? Point-to-Point Protocol mode? How was that mode selected? Not in my simple script.
-
Errors in the example script given for LoRaWAN v1.1.x?Could it be that there are two errors in the example script given for LoRaWAN v1.1.x (link text)?
Line 43 should read “version = lora._version.VERSION_1_1_X,”, and not “version = lora._version.VERSION_1_0_X,”
Line 98 in the statement “while i < 1010:”, the ‘<’ character gives a warning in VScode, and an error when running it on the F1. It needs to be replaced by U+003c symbol ‘<’

-
Documentation mentions Sigfox?Sigfox is mentioned several times in the documentation (e.g. link text). Can the F1 starter kit also use Sigfox? If yes, how?
