test code
`
program project1;
uses rpi_hal,pfio,sysutils;
var s:string;
begin
RPI_HW_Start([InitHaltOnError,InitGPIO,InitSPI,InitI2C]);
writeln('a');
I2C_string_write(RPI_I2C_busgen,$50,$20,#$01+#$02+#$34+#$56,NO_ERRHNDL);
writeln('b');
I2C_string_read(RPI_I2C_busgen,$50,$20,2,NO_ERRHNDL,s);
writeln(s);
end.
`
pi@raspberrypi:~/btest $ sudo ./project1
2019-10-03 10:24:57 WRN SPI_Dev_Init[0x00/00]: /dev/spidev0.0
2019-10-03 10:24:57 WRN SPI_Dev_Init[0x00/01]: /dev/spidev0.1
a
b
2019-10-03 10:24:57 ERR I2C_bus_WrRd[0x01/0x50]: failed to read device: (121) Remote I/O error
read 24c02 is error , but write 0x01023456 is OK 。
pi@raspberrypi:~/btest $ i2cdump -y 1 0x50
No size specified (using byte-data access)
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
00: 01 02 00 00 81 24 03 00 00 01 68 ff ff ff ff ff ??..?$?..?h.....
10: ff 0b 0c 0e ff ff ff ff ff ff ff ff ff ff ff ff .???............
20: 01 02 34 56 ff ff ff ff ff ff ff ff ff ff ff ff ??4V............
test code
`
program project1;
uses rpi_hal,pfio,sysutils;
var s:string;
begin
RPI_HW_Start([InitHaltOnError,InitGPIO,InitSPI,InitI2C]);
writeln('a');
I2C_string_write(RPI_I2C_busgen,$50,$20,#$01+#$02+#$34+#$56,NO_ERRHNDL);
writeln('b');
I2C_string_read(RPI_I2C_busgen,$50,$20,2,NO_ERRHNDL,s);
writeln(s);
end.
`
pi@raspberrypi:~/btest $ sudo ./project1
2019-10-03 10:24:57 WRN SPI_Dev_Init[0x00/00]: /dev/spidev0.0
2019-10-03 10:24:57 WRN SPI_Dev_Init[0x00/01]: /dev/spidev0.1
a
b
2019-10-03 10:24:57 ERR I2C_bus_WrRd[0x01/0x50]: failed to read device: (121) Remote I/O error
read 24c02 is error , but write 0x01023456 is OK 。
pi@raspberrypi:~/btest $ i2cdump -y 1 0x50
No size specified (using byte-data access)
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
00: 01 02 00 00 81 24 03 00 00 01 68 ff ff ff ff ff ??..?$?..?h.....
10: ff 0b 0c 0e ff ff ff ff ff ff ff ff ff ff ff ff .???............
20: 01 02 34 56 ff ff ff ff ff ff ff ff ff ff ff ff ??4V............