Skip to content
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

chip verification fails on onion omega2+ #31

Open
fphammerle opened this issue Jan 24, 2021 · 3 comments
Open

chip verification fails on onion omega2+ #31

fphammerle opened this issue Jan 24, 2021 · 3 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@fphammerle
Copy link
Owner

root@Omega-****:~# python3
Python 3.6.10 (default, Apr 09 2020, 14:46:56) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cc1101
>>> with cc1101.CC1101(spi_bus=0, spi_chip_select=1) as t:
... 	print(t)
... 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.6/site-packages/cc1101/__init__.py", line 526, in __enter__
    self._verify_chip()
  File "/usr/lib/python3.6/site-packages/cc1101/__init__.py", line 484, in _verify_chip
    partnum, self._SUPPORTED_PARTNUM
ValueError: unexpected chip part number 112 (expected: 0)
>>> 
root@Omega-****:~# python3
Python 3.6.10 (default, Apr 09 2020, 14:46:56) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cc1101
>>> with cc1101.CC1101(spi_bus=0, spi_chip_select=1) as t:
... 	print(t)
... 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.6/site-packages/cc1101/__init__.py", line 526, in __enter__
    self._verify_chip()
  File "/usr/lib/python3.6/site-packages/cc1101/__init__.py", line 484, in _verify_chip
    partnum, self._SUPPORTED_PARTNUM
ValueError: unexpected chip part number 32 (expected: 0)
>>>
root@Omega-****:~# grep ^Version /usr/lib/python3.6/site-packages/cc1101-2.6.1.dist-info/METADATA
Version: 2.6.1
root@Omega-****:~# opkg info python3 | grep Version
Version: 3.6.10-1
root@Omega-****:~# opkg info python3-spidev
Package: python3-spidev
Version: 4.0.1-2
Depends: libc, python3-base
Status: install user installed
Architecture: mipsel_24kc
Installed-Time: 1610908467

board: https://onion.io/store/omega2p/

wiring: https://docs.onion.io/omega2-docs/communicating-with-spi-devices.html

@fphammerle fphammerle added bug Something isn't working help wanted Extra attention is needed labels Jan 24, 2021
@fphammerle
Copy link
Owner Author

fphammerle commented Jan 24, 2021

Same transceiver, now connected to raspberry pi 2B:

$ pip3 show cc1101 | grep ^Version
Version: 2.7.0
$ ~/.local/bin/cc1101-export-config >/dev/null
CC1101(marcstate=idle, base_frequency=800.00MHz, symbol_rate=115.05kBaud, modulation_format=ASK_OOK, sync_mode=TRANSMIT_16_MATCH_16_BITS, preamble_length=4B, sync_word=0xd391, packet_length≤255B, output_power=(0xc6,0))

@fphammerle
Copy link
Owner Author

max_speed_hz = n with n <= 47100 triggers

Traceback (most recent call last):
  File "cc1101_test.py", line 2, in <module>
    with cc1101.CC1101(spi_bus=0, spi_chip_select=1) as t:
  File "/usr/lib/python3.6/site-packages/cc1101/__init__.py", line 524, in __enter__
    self._spi.max_speed_hz = 47100 # empirical
OSError: [Errno 22] Invalid argument
static int
SpiDev_set_max_speed_hz(SpiDevObject *self, PyObject *val, void *closure)
{
	// ...
	if (self->max_speed_hz != max_speed_hz) {
		if (ioctl(self->fd, SPI_IOC_WR_MAX_SPEED_HZ, &max_speed_hz) == -1) {
			PyErr_SetFromErrno(PyExc_IOError);
			return -1;
		}
		self->max_speed_hz = max_speed_hz;
	}
	return 0;
}

https://github.com/OnionIoT/python-spidev/blob/acde79b6ef485f7ff32daf391aef285af5091def/spidev_module.c#L661

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant