From 5b416b699bf4baccc5349e6050695ddab0badb0e Mon Sep 17 00:00:00 2001 From: joan2937 Date: Sun, 7 Jul 2019 12:52:44 +0100 Subject: [PATCH] V69+: #280 SPI/BSC SLAVE peripheral not available on BCM2711 --- command.c | 4 +++- command.h | 2 +- pigpio.3 | 10 ++++++++++ pigpio.c | 3 +++ pigpio.h | 8 ++++++-- pigpio.py | 12 +++++++++++- pigpiod_if2.3 | 12 ++++++++++++ pigpiod_if2.c | 2 +- pigpiod_if2.h | 8 +++++++- pigs.1 | 4 ++++ pigs.c | 5 +++-- setup.py | 2 +- 12 files changed, 62 insertions(+), 10 deletions(-) diff --git a/command.c b/command.c index 7b339ea..7a799ae 100644 --- a/command.c +++ b/command.c @@ -26,7 +26,7 @@ For more information, please refer to */ /* -This version is for pigpio version 67+ +This version is for pigpio version 69+ */ #include @@ -564,6 +564,8 @@ static errInfo_t errInfo[]= {PI_NOT_SPI_GPIO , "no bit bang SPI in progress on GPIO"}, {PI_BAD_EVENT_ID , "bad event id"}, {PI_CMD_INTERRUPTED , "command interrupted, Python"}, + {PI_NOT_ON_BCM2711 , "not available on BCM2711"}, + {PI_ONLY_ON_BCM2711 , "only available on BCM2711"}, }; diff --git a/command.h b/command.h index d95eb49..0a09d69 100644 --- a/command.h +++ b/command.h @@ -26,7 +26,7 @@ For more information, please refer to */ /* -This version is for pigpio version 57+ +This version is for pigpio version 69+ */ #ifndef COMMAND_H diff --git a/pigpio.3 b/pigpio.3 index b37f1e5..54e23e1 100644 --- a/pigpio.3 +++ b/pigpio.3 @@ -3634,6 +3634,12 @@ Pi to act as a slave device on an I2C or SPI bus. .br +.br +This function is not available on the BCM2711 (e.g. as +used in the Pi4B). + +.br + .br I can't get SPI to work properly. I tried with a control word of 0x303 and swapped MISO and MOSI. @@ -10355,6 +10361,10 @@ A 16-bit word value. .br #define PI_CMD_INTERRUPTED -144 // Used by Python .br +#define PI_NOT_ON_BCM2711 -145 // not available on BCM2711 +.br +#define PI_ONLY_ON_BCM2711 -146 // only available on BCM2711 +.br .br #define PI_PIGIF_ERR_0 -2000 diff --git a/pigpio.c b/pigpio.c index 282e800..fc308d8 100644 --- a/pigpio.c +++ b/pigpio.c @@ -10731,6 +10731,9 @@ int bscXfer(bsc_xfer_t *xfer) CHECK_INITED; + if (pi_is_2711) + SOFT_ERROR(PI_NOT_ON_BCM2711, "SPI/BSC slave not available on BCM2711"); + eventAlert[PI_EVENT_BSC].ignore = 1; if (xfer->control) diff --git a/pigpio.h b/pigpio.h index b61c503..178e3c8 100644 --- a/pigpio.h +++ b/pigpio.h @@ -13,7 +13,6 @@ of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. @@ -31,7 +30,7 @@ For more information, please refer to #include #include -#define PIGPIO_VERSION 6901 +#define PIGPIO_VERSION 6902 /*TEXT @@ -2880,6 +2879,9 @@ This function provides a low-level interface to the SPI/I2C Slave peripheral. This peripheral allows the Pi to act as a slave device on an I2C or SPI bus. +This function is not available on the BCM2711 (e.g. as +used in the Pi4B). + I can't get SPI to work properly. I tried with a control word of 0x303 and swapped MISO and MOSI. @@ -6426,6 +6428,8 @@ after this command is issued. #define PI_NOT_SPI_GPIO -142 // no bit bang SPI in progress on GPIO #define PI_BAD_EVENT_ID -143 // bad event id #define PI_CMD_INTERRUPTED -144 // Used by Python +#define PI_NOT_ON_BCM2711 -145 // not available on BCM2711 +#define PI_ONLY_ON_BCM2711 -146 // only available on BCM2711 #define PI_PIGIF_ERR_0 -2000 #define PI_PIGIF_ERR_99 -2099 diff --git a/pigpio.py b/pigpio.py index ae7be89..d66485d 100644 --- a/pigpio.py +++ b/pigpio.py @@ -300,7 +300,7 @@ import threading import os import atexit -VERSION = "1.42" +VERSION = "1.43" exceptions = True @@ -689,6 +689,8 @@ PI_BAD_SPI_BAUD =-141 PI_NOT_SPI_GPIO =-142 PI_BAD_EVENT_ID =-143 PI_CMD_INTERRUPTED =-144 +PI_NOT_ON_BCM2711 =-145 +PI_ONLY_ON_BCM2711 =-146 # pigpio error text @@ -835,6 +837,8 @@ _errors=[ [PI_NOT_SPI_GPIO , "no bit bang SPI in progress on GPIO"], [PI_BAD_EVENT_ID , "bad event id"], [PI_CMD_INTERRUPTED , "pigpio command interrupted"], + [PI_NOT_ON_BCM2711 , "not available on BCM2711"], + [PI_ONLY_ON_BCM2711 , "only available on BCM2711"], ] _except_a = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n{}" @@ -3513,6 +3517,9 @@ class pi(): SPI/I2C Slave peripheral. This peripheral allows the Pi to act as a slave device on an I2C or SPI bus. + This function is not available on the BCM2711 (e.g. as + used in the Pi4B). + I can't get SPI to work properly. I tried with a control word of 0x303 and swapped MISO and MOSI. @@ -3619,6 +3626,9 @@ class pi(): """ This function allows the Pi to act as a slave I2C device. + This function is not available on the BCM2711 (e.g. as + used in the Pi4B). + The data bytes (if any) are written to the BSC transmit FIFO and the bytes in the BSC receive FIFO are returned. diff --git a/pigpiod_if2.3 b/pigpiod_if2.3 index d91c686..f39dfa4 100644 --- a/pigpiod_if2.3 +++ b/pigpiod_if2.3 @@ -5604,6 +5604,12 @@ Pi to act as a slave device on an I2C or SPI bus. .br +.br +This function is not available on the BCM2711 (e.g. as +used in the Pi4B). + +.br + .br I can't get SPI to work properly. I tried with a control word of 0x303 and swapped MISO and MOSI. @@ -5847,6 +5853,12 @@ This function allows the Pi to act as a slave I2C device. .br +.br +This function is not available on the BCM2711 (e.g.as +used in the Pi4B). + +.br + .br The data bytes (if any) are written to the BSC transmit FIFO and the bytes in the BSC receive FIFO are returned. diff --git a/pigpiod_if2.c b/pigpiod_if2.c index 85bc27c..fa97d31 100644 --- a/pigpiod_if2.c +++ b/pigpiod_if2.c @@ -25,7 +25,7 @@ OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to */ -/* PIGPIOD_IF2_VERSION 13 */ +/* PIGPIOD_IF2_VERSION 14 */ #include #include diff --git a/pigpiod_if2.h b/pigpiod_if2.h index 062f71c..4cd7cf8 100644 --- a/pigpiod_if2.h +++ b/pigpiod_if2.h @@ -30,7 +30,7 @@ For more information, please refer to #include "pigpio.h" -#define PIGPIOD_IF2_VERSION 13 +#define PIGPIOD_IF2_VERSION 14 /*TEXT @@ -3402,6 +3402,9 @@ This function provides a low-level interface to the SPI/I2C Slave peripheral. This peripheral allows the Pi to act as a slave device on an I2C or SPI bus. +This function is not available on the BCM2711 (e.g. as +used in the Pi4B). + I can't get SPI to work properly. I tried with a control word of 0x303 and swapped MISO and MOSI. @@ -3522,6 +3525,9 @@ int bsc_i2c(int pi, int i2c_addr, bsc_xfer_t *bscxfer); /*D This function allows the Pi to act as a slave I2C device. +This function is not available on the BCM2711 (e.g.as +used in the Pi4B). + The data bytes (if any) are written to the BSC transmit FIFO and the bytes in the BSC receive FIFO are returned. diff --git a/pigs.1 b/pigs.1 index ebb0777..cb55e3d 100644 --- a/pigs.1 +++ b/pigs.1 @@ -542,6 +542,10 @@ ERROR: no permission to update one or more GPIO This command performs a BSC I2C/SPI slave transfer as defined by \fBbctl\fP with data \fBbvs\fP. +.br +This function is not available on the BCM2711 (e.g. as +used in the Pi4B). + .br I can't get SPI to work properly. I tried with a control word of 0x303 and swapped MISO and MOSI. diff --git a/pigs.c b/pigs.c index 0d0f44e..928afa3 100644 --- a/pigs.c +++ b/pigs.c @@ -26,7 +26,7 @@ For more information, please refer to */ /* -This version is for pigpio version 67+ +This version is for pigpio version 69+ */ #include @@ -233,8 +233,9 @@ void print_result(int sock, int rv, cmdCmd_t cmd) */ if (r < 0) { - printf("%d", r); + printf("%d\n", r); report(PIGS_SCRIPT_ERR, "ERROR: %s", cmdErrStr(r)); + break; } p = (uint32_t *)response_buf; diff --git a/setup.py b/setup.py index 9de06d2..a0cb293 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ from distutils.core import setup setup(name='pigpio', - version='1.42', + version='1.43', author='joan', author_email='joan@abyz.me.uk', maintainer='joan',