-
Notifications
You must be signed in to change notification settings - Fork 2
W60x-I2C - fixed bug in machine_hard_i2c_transfer() #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
This commit ensures that the BLE stack is active before allowing operations that may otherwise crash if it's not active. It also clarifies the state better (adding the "stopping" state) and renames mp_bluetooth_is_enabled to the more self-explanatory mp_bluetooth_is_active.
Most error handling is done via `bluetooth_handle_errno()` already. Replace the remaining few manual checks with calls to that function.
This fixes a crash, caused by NimBLE continuing to call the Python BLE interrupt handler after soft reboot.
This commit changes the BLE _IRQ_SCAN_RESULT data from:
addr_type, addr, connectable, rssi, adv_data
to:
addr_type, addr, adv_type, rssi, adv_data
This allows _IRQ_SCAN_RESULT to handle all scan result types (not just
connectable and non-connectable passive scans), and to distinguish between
them using adv_type which is an integer taking values 0x00-0x04 per the BT
specification.
This is a breaking change to the API, albeit a very minor one: the existing
connectable value was a boolean and True now becomes 0x00, False becomes
0x02.
Documentation is updated and a test added.
Fixes micropython#5738.
This is needed for BLE.config('mac') to work on esp32.
The double-% was added in 11de839 (Jun 2014) when such errors were formatted with printf. But then 55830dd (Dec 2018) changed mp_obj_new_exception_msg() to not format the message, as discussed in micropython#3004. So such error strings are no longer formatted and a % is just that.
This eliminates the need for the sizeof regex fixup by rearranging things a bit. All other bitfields already use the parentheses around expressions with sizeof, so one case is fixed by following this convention. VM_MAX_STATE_ON_STACK is the only remaining problem and it can be worked around by changing the order of the operands.
To match file objects. Fixes issue micropython#5581.
This is an extremely minimal port to the NXP i.MX RT, in the style of the
SAMD port It's largely based on the TinyUSB mimxrt implementation, using
the NXP SDK. It currently supports the Teensy 4.0 board with a REPL over
the USB-VCP interface.
This commit also adds the NXP SDK submodule (also from TinyUSB) to
lib/nxp_driver.
Note: if you already have the tinyusb submodule initialized recursively you
will need to run the following as the tinyusb sub-submodules have been
rearranged (upstream):
git submodule deinit lib/tinyusb
rm -rf .git/modules/lib/tinyusb
git submodule update --init lib/tinyusb
This commit adds micropython.heap_locked() which returns the current lock-depth of the heap, and can be used by Python code to check if the heap is locked or not. This new function is configured via MICROPY_PY_MICROPYTHON_HEAP_LOCKED and is disabled by default. This commit also changes the return value of micropython.heap_unlock() so it returns the current lock-depth as well.
So that they are skipped when running on a target that doesn't support the native emitter, eg a nanbox build.
Adds support in the zephyr port to mount a file system if a block device (sdhc disk access or flash area) is available. The mount point is either "/sd" or "/flash" depending on the type of block device. Tested with an sdhc disk access block device and fatfs on the mimxrt1050_evk board. Tested with a flash area block device and littlefs on the reel_board.
Enables the zephyr usb device stack and mass storage class on the mimxrt1050_evk board. The mass storage class is backed by the sdhc disk access driver, so it's now possible to browse and modify the contents of the SD card from a USB host (your PC). This is in preparation to support writing a main.py script to the SD card, and then executing it after the next reset.
Adds support in the zephyr port to execute main.py if the file system is enabled and the file exists. Existing support for executing a main.py frozen module is preserved, since pyexec_file_if_exists() works just like pyexec_frozen_module() if there's no vfs.
Follow up to dd0bc26 which changed the parameter list of the IRQ_SCAN_RESULT event. Adapt ble_temperature_central.py accordingly.
STATE_NEW will return HUP when polled so put active UDP sockets into a new state which is different to STATE_NEW. Fixes issue micropython#5758.
Fixes UDP non-blocking recv so it returns EAGAIN instead of ETIMEDOUT. Timeout waiting for incoming data is also improved by replacing 100ms delay with poll_sockets(), as is done in other parts of this module. Fixes issue micropython#5759.
Also support MP_STREAM_GET_FILENO ioctl. The stdio flush change was done previously for the unix port in 3e0b46b. These changes make this POSIX file implementation equivalent to the unix file implementation.
The implementation in extmod/vfs_posix_file.c is now equivalent to that in ports/unix/file.c, so remove the latter and use the former instead.
|
Looks better this way. |
|
I tested that again and it works. I'm sure that I tested it before. Just as a hint: I use the repository here just as a "backport" place. Usually I maintain a repo here: https://github.com/robert-hh/micropython/tree/w60x |
|
I've created a PR in your fork as well. Which SDK version are you using? I test with G3.02. With G3.04 I can't make it compile in the 1M flash version. Currently I run into problems getting OneWire to work, because the W60x-SDK has no "real" OPEN_DRAIN mode. I'm working on this right now. |
|
The "Official one" is the one from Winner Micro. I'm using my fork because I prefer to have a recent Micropython version. I changed it already to match your PR form yesterday. That way you cannot use the compressed flash method any more. You can then also increase the size of the flash FS. By modifying the flash script you can also prevent the file system to be erased all the time change: About Onewire: the software version of I2C has the same problems. It uses the macros from include/mphalport.h: |
|
I managed to get some reading from a DS18B20 sensor using a modified modonewire.c file (copy below). That's just the working state. The biggest problem is, that the timing of mp_hal_delay_us() is wrong. As a first hack, I modified the values in modonewire.c to tell, whether it would work then. Next is to fix mp_hal_delay_us(). I moved modonewire.c into the modules folder of the W60x port. |
|
Thanks for your work! I've also stumbled upon the timing problem. delay_us is way off - a simple loop with 2 x 500 µs delays resulted in a 390 Hz signal, while 1 kHz is expected. I fixed this by using tls_usleep in mphalport.c (will provide a PR for this as well). Now I'm trying to get this all together working with the unmodified OneWire code from MP. |
|
Implementing OPEN_DRAIN in the PIN class is surely a good thing. You have to store in the pin object the output mode, and then you can decide upon writing a 1, which way to go. That seems straightforward. But at a few files mp_hal_pin_write() is called, which For these you have to extend mp_hal_pin_obj_t to carry the output mode too. Using tls_usleep() instead of delay_us() does not work for me. After a few delays, the micro simply stalls. |
|
delay_us is exported in the wlan-library (wlan.lib/wlan.a) - |
|
OK. No wonder that I did not find it in the sources. And I did not look yet into the linker map (and ignored grep telling it). |
The PWM driver uses a double buffer for the PWM timing array, one in current use and the other one to update when changing duty parameters. The issue was that once the duty parameters were changed the updated buffer was applied immediately without synchronising to the start of the PWM period. By moving the buffer toggling/swapping to the interrupt when the cycle is done there are no more glitches.
The linker script was included in the "$^" inputs, causing the build to fail: LINK build/firmware.elf powerpc64le-linux-gnu-ld: error: linker script file 'powerpc.lds' appears multiple times As a fix the linker script is left as a dependency of the elf, but only the object files are linked.
Most developers use a compiler which is called powerpc64le-linux-gnu-gcc.
The env NAME="foo" syntax doesn't appear to set the name in the Travis web interface. Instead use the syntax from the docs: https://docs.travis-ci.com/user/build-stages/#naming-your-jobs-within-build-stages
Otherwise scheduled functions may execute during the hard callback and then fail if they try to allocate heap memory.
Otherwise functions like memset might get optimised to call themselves (eg with gcc 10). And provide CFLAGS_BUILTIN so these options can be changed by a port if needed. Fixes issue micropython#6053.
Older implementations deal with infinity/negative zero incorrectly. This commit adds generic fixes that can be enabled by any port that needs them, along with new tests cases.
Older versions do not have "inline" so fetch the definition from mpconfigport.h.
Add configuration which otherwise has to be set via the UI so the file is more self-contained, and remove configuration which is not needed because it's the same as the default. The major change here is that for a while now Appveyor has been using Visual Studio 2015 by default while we still want to support 2013.
This renames a few identifiers to follow the usual naming convention of mp_<module>_<name>. This makes them easier to find, e.g. when grep'ing.
This suppresses the Parsing: <file> as language C lines. This makes parsing run a bit faster and on CI it makes for less scrolling through logs (and black already uses the -q option).
To allow high speed access.
The code previously called rtc_get_reset_reason which is a "raw" reset cause. The ESP-IDF massages that for the proper reset cause available from esp_reset_reason. Fixes issue micropython#5134.
Microwatt may have firmware that places data in r3, which was used to detect microwatt vs powernv. This breaks the existing probing of the UART type in this powerpc port. Instead build only the appropriate UART into the firmware, selected by passing the option UART=potato or UART=lpc_serial to the Makefile. A future enhancement would be to parse the device tree and configure MicroPython based on the settings.
The powerpc port can be built with two different UART drivers, so build both in CI. The default compiler is now powerpc64le-linux-gnu- so it does not need to be specified on the command line.
This adds a new command line option `-v` to `tools/codeformat.py` to enable verbose printing of all files that are scanned. Normally `uncrustify` and `black` are called with the `-q` option so setting verbose suppresses the `-q` option and on `black` also enables the `-v` option which makes it print out all file names matching the filter similar to how `uncrustify` does by default.
|
This change sneaked in as part of the most recent merges. So the PR can be closed. |
parenthesis-typo caused tls_reg_read() to hang on invalid register