You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Shield connected to SPI pins 12-15 due to official pinout
Version
v4.0.6
IDE Name
Arduino IDE 2
Operating System
macOS
Auto Flash Mode
Disable
Erase All Flash Memory (16MB)
Disable
Standard Lib
Arduino_STD_PRINTF
Upload Speed
2000000
Description
I'm trying to connect ethernet shield and modify library to support AMB82 but never had luck. After digging inside library has found that SPI function transfer() always return 0, but with description should return response from slave:
Code from library:
byte SPIClass::transfer(uint8_t _data, SPITransferMode _mode){ // transfer 1 byte data without SS
(void)_mode;
spi_master_write((spi_t *)pSpiMaster, _data);
//printf("Master write: %02X\n\r", _data);
return 0;
}
Same time, _mode has no effect in this point as well.
Description official API says: Returns This function either returns NA or data of 8-bits that transferred through SPI master to the slave. but from code, it seams that 0 should always returned.
Function spi_master_write returning data, has read after data transfer so far I found inside SDK:
(file: component/mbed/targets/hal/rtl8735b/spi_api.c)
static inline void ssi_write(spi_t *obj, int value)
{
phal_ssi_adaptor_t phal_ssi_adaptor = &(obj->hal_ssi_adaptor);
while (!hal_ssi_writable(phal_ssi_adaptor));
hal_ssi_write(phal_ssi_adaptor, value);
}
static inline int ssi_read(spi_t *obj)
{
phal_ssi_adaptor_t phal_ssi_adaptor = &(obj->hal_ssi_adaptor);
while (!hal_ssi_readable(phal_ssi_adaptor));
return (int)hal_ssi_read(phal_ssi_adaptor);
}
int spi_master_write(spi_t *obj, int value)
{
ssi_write(obj, value);
return ssi_read(obj);
}
Which means that data has been received after transfer should be received.
Meanwhile, I've tried to modify SPI.cpp file with some like this:
byte SPIClass::transfer(uint8_t data, SPITransferMode mode) { // transfer 1 byte data without SS
(void)mode;
spi_master_write(pSpiMaster, data);
u_int8_t _rcvData = spi_master_write(pSpiMaster, data);
printf("\r\n[INFO] Master write: %02X receive %02X\n", data, _rcvData);
return _rcvData;
}
and now basic loopback test (jumped SI/SO pins) works, but anyway in general drivers for SPI devices that works not only in "TRANSFER_ONLY" mode, it's not enough because driver stacks at something like:
Which means that data response not transferred back or it works in some mode, that a'm not familiar yet.
Same time, function transfer16 will never works well, such as inside method data respect to receiver response from transfer function which is always 0:
Hello, hope this message finds you well. Congrats to your first Issue! We will review it as soon as possiable. Feel free to have a look at https://www.amebaiot.com/en/ameba-arduino-summary/ for more information
Boards
AMB23/SPI
External Hardware
28J60 ethernet shield or MCP1251 CAN shield
Hardware Configuration
Shield connected to SPI pins 12-15 due to official pinout
Version
v4.0.6
IDE Name
Arduino IDE 2
Operating System
macOS
Auto Flash Mode
Disable
Erase All Flash Memory (16MB)
Disable
Standard Lib
Arduino_STD_PRINTF
Upload Speed
2000000
Description
I'm trying to connect ethernet shield and modify library to support AMB82 but never had luck. After digging inside library has found that SPI function
transfer()
always return 0, but with description should return response from slave:Code from library:
Same time,
_mode
has no effect in this point as well.Description official API says:
Returns This function either returns NA or data of 8-bits that transferred through SPI master to the slave.
but from code, it seams that 0 should always returned.Function
spi_master_write
returning data, has read after data transfer so far I found inside SDK:(file: component/mbed/targets/hal/rtl8735b/spi_api.c)
Which means that data has been received after transfer should be received.
Meanwhile, I've tried to modify
SPI.cpp
file with some like this:and now basic loopback test (jumped SI/SO pins) works, but anyway in general drivers for SPI devices that works not only in "TRANSFER_ONLY" mode, it's not enough because driver stacks at something like:
Which means that data response not transferred back or it works in some mode, that a'm not familiar yet.
Same time, function
transfer16
will never works well, such as inside method data respect to receiver response fromtransfer
function which is always 0:Sketch
Error/Debug Message
Reproduce remarks
No response
I have checked online documentation, FAQ, GitHub Wiki and existing/closed issues.
The text was updated successfully, but these errors were encountered: