V69+: #280 SPI/BSC SLAVE peripheral not available on BCM2711

This commit is contained in:
joan2937 2019-07-07 12:52:44 +01:00
parent e41362f243
commit 5b416b699b
12 changed files with 62 additions and 10 deletions

View File

@ -26,7 +26,7 @@ For more information, please refer to <http://unlicense.org/>
*/ */
/* /*
This version is for pigpio version 67+ This version is for pigpio version 69+
*/ */
#include <stdio.h> #include <stdio.h>
@ -564,6 +564,8 @@ static errInfo_t errInfo[]=
{PI_NOT_SPI_GPIO , "no bit bang SPI in progress on GPIO"}, {PI_NOT_SPI_GPIO , "no bit bang SPI in progress on GPIO"},
{PI_BAD_EVENT_ID , "bad event id"}, {PI_BAD_EVENT_ID , "bad event id"},
{PI_CMD_INTERRUPTED , "command interrupted, Python"}, {PI_CMD_INTERRUPTED , "command interrupted, Python"},
{PI_NOT_ON_BCM2711 , "not available on BCM2711"},
{PI_ONLY_ON_BCM2711 , "only available on BCM2711"},
}; };

View File

@ -26,7 +26,7 @@ For more information, please refer to <http://unlicense.org/>
*/ */
/* /*
This version is for pigpio version 57+ This version is for pigpio version 69+
*/ */
#ifndef COMMAND_H #ifndef COMMAND_H

View File

@ -3634,6 +3634,12 @@ Pi to act as a slave device on an I2C or SPI bus.
.br .br
.br
This function is not available on the BCM2711 (e.g. as
used in the Pi4B).
.br
.br .br
I can't get SPI to work properly. I tried with a I can't get SPI to work properly. I tried with a
control word of 0x303 and swapped MISO and MOSI. control word of 0x303 and swapped MISO and MOSI.
@ -10355,6 +10361,10 @@ A 16-bit word value.
.br .br
#define PI_CMD_INTERRUPTED -144 // Used by Python #define PI_CMD_INTERRUPTED -144 // Used by Python
.br .br
#define PI_NOT_ON_BCM2711 -145 // not available on BCM2711
.br
#define PI_ONLY_ON_BCM2711 -146 // only available on BCM2711
.br
.br .br
#define PI_PIGIF_ERR_0 -2000 #define PI_PIGIF_ERR_0 -2000

View File

@ -10731,6 +10731,9 @@ int bscXfer(bsc_xfer_t *xfer)
CHECK_INITED; 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; eventAlert[PI_EVENT_BSC].ignore = 1;
if (xfer->control) if (xfer->control)

View File

@ -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 successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this relinquishment in perpetuity of all present and future rights to this
software under copyright law. software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
@ -31,7 +30,7 @@ For more information, please refer to <http://unlicense.org/>
#include <stdint.h> #include <stdint.h>
#include <pthread.h> #include <pthread.h>
#define PIGPIO_VERSION 6901 #define PIGPIO_VERSION 6902
/*TEXT /*TEXT
@ -2880,6 +2879,9 @@ This function provides a low-level interface to the
SPI/I2C Slave peripheral. This peripheral allows the SPI/I2C Slave peripheral. This peripheral allows the
Pi to act as a slave device on an I2C or SPI bus. 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 I can't get SPI to work properly. I tried with a
control word of 0x303 and swapped MISO and MOSI. 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_NOT_SPI_GPIO -142 // no bit bang SPI in progress on GPIO
#define PI_BAD_EVENT_ID -143 // bad event id #define PI_BAD_EVENT_ID -143 // bad event id
#define PI_CMD_INTERRUPTED -144 // Used by Python #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_0 -2000
#define PI_PIGIF_ERR_99 -2099 #define PI_PIGIF_ERR_99 -2099

View File

@ -300,7 +300,7 @@ import threading
import os import os
import atexit import atexit
VERSION = "1.42" VERSION = "1.43"
exceptions = True exceptions = True
@ -689,6 +689,8 @@ PI_BAD_SPI_BAUD =-141
PI_NOT_SPI_GPIO =-142 PI_NOT_SPI_GPIO =-142
PI_BAD_EVENT_ID =-143 PI_BAD_EVENT_ID =-143
PI_CMD_INTERRUPTED =-144 PI_CMD_INTERRUPTED =-144
PI_NOT_ON_BCM2711 =-145
PI_ONLY_ON_BCM2711 =-146
# pigpio error text # pigpio error text
@ -835,6 +837,8 @@ _errors=[
[PI_NOT_SPI_GPIO , "no bit bang SPI in progress on GPIO"], [PI_NOT_SPI_GPIO , "no bit bang SPI in progress on GPIO"],
[PI_BAD_EVENT_ID , "bad event id"], [PI_BAD_EVENT_ID , "bad event id"],
[PI_CMD_INTERRUPTED , "pigpio command interrupted"], [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{}" _except_a = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n{}"
@ -3513,6 +3517,9 @@ class pi():
SPI/I2C Slave peripheral. This peripheral allows the SPI/I2C Slave peripheral. This peripheral allows the
Pi to act as a slave device on an I2C or SPI bus. 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 I can't get SPI to work properly. I tried with a
control word of 0x303 and swapped MISO and MOSI. 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 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 The data bytes (if any) are written to the BSC transmit
FIFO and the bytes in the BSC receive FIFO are returned. FIFO and the bytes in the BSC receive FIFO are returned.

View File

@ -5604,6 +5604,12 @@ Pi to act as a slave device on an I2C or SPI bus.
.br .br
.br
This function is not available on the BCM2711 (e.g. as
used in the Pi4B).
.br
.br .br
I can't get SPI to work properly. I tried with a I can't get SPI to work properly. I tried with a
control word of 0x303 and swapped MISO and MOSI. 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
.br
This function is not available on the BCM2711 (e.g.as
used in the Pi4B).
.br
.br .br
The data bytes (if any) are written to the BSC transmit The data bytes (if any) are written to the BSC transmit
FIFO and the bytes in the BSC receive FIFO are returned. FIFO and the bytes in the BSC receive FIFO are returned.

View File

@ -25,7 +25,7 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org/> For more information, please refer to <http://unlicense.org/>
*/ */
/* PIGPIOD_IF2_VERSION 13 */ /* PIGPIOD_IF2_VERSION 14 */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@ -30,7 +30,7 @@ For more information, please refer to <http://unlicense.org/>
#include "pigpio.h" #include "pigpio.h"
#define PIGPIOD_IF2_VERSION 13 #define PIGPIOD_IF2_VERSION 14
/*TEXT /*TEXT
@ -3402,6 +3402,9 @@ This function provides a low-level interface to the
SPI/I2C Slave peripheral. This peripheral allows the SPI/I2C Slave peripheral. This peripheral allows the
Pi to act as a slave device on an I2C or SPI bus. 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 I can't get SPI to work properly. I tried with a
control word of 0x303 and swapped MISO and MOSI. 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 /*D
This function allows the Pi to act as a slave I2C device. 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 The data bytes (if any) are written to the BSC transmit
FIFO and the bytes in the BSC receive FIFO are returned. FIFO and the bytes in the BSC receive FIFO are returned.

4
pigs.1
View File

@ -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 This command performs a BSC I2C/SPI slave transfer as defined by
\fBbctl\fP with data \fBbvs\fP. \fBbctl\fP with data \fBbvs\fP.
.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 I can't get SPI to work properly. I tried with a
control word of 0x303 and swapped MISO and MOSI. control word of 0x303 and swapped MISO and MOSI.

5
pigs.c
View File

@ -26,7 +26,7 @@ For more information, please refer to <http://unlicense.org/>
*/ */
/* /*
This version is for pigpio version 67+ This version is for pigpio version 69+
*/ */
#include <stdio.h> #include <stdio.h>
@ -233,8 +233,9 @@ void print_result(int sock, int rv, cmdCmd_t cmd)
*/ */
if (r < 0) if (r < 0)
{ {
printf("%d", r); printf("%d\n", r);
report(PIGS_SCRIPT_ERR, "ERROR: %s", cmdErrStr(r)); report(PIGS_SCRIPT_ERR, "ERROR: %s", cmdErrStr(r));
break;
} }
p = (uint32_t *)response_buf; p = (uint32_t *)response_buf;

View File

@ -3,7 +3,7 @@
from distutils.core import setup from distutils.core import setup
setup(name='pigpio', setup(name='pigpio',
version='1.42', version='1.43',
author='joan', author='joan',
author_email='joan@abyz.me.uk', author_email='joan@abyz.me.uk',
maintainer='joan', maintainer='joan',