- Wed Mar 10, 2021 1:24 pm
#223860
Hi guys,
I'm having a strange problem here accessing a sd card. I have the same code running on a ATSAM device, so the code is fine. I'm trying to track down the issue a couple of days now. At the moment I'm anaylizing the SPI data with an oscilloscope capable of serial decoding.
It turns out that for the first couple of commands the SPI read is ok i.e. the MOSI is high during read. But at some point the situation changes and even when I when I execute a SPI read the Apollo3 seems to do a SPI write with value 0.
See the attached screenshot of the oscilloscope.
The low MOSI during read seems to confe the SD card because the following commands fail then.
Does anyone of you have a clue on that?
I have attached to screenshots of the oscilloscope. Both are captured by executing the code
This is a real blocker for me. So please write me something, even if you don't have any ideas
I'm having a strange problem here accessing a sd card. I have the same code running on a ATSAM device, so the code is fine. I'm trying to track down the issue a couple of days now. At the moment I'm anaylizing the SPI data with an oscilloscope capable of serial decoding.
It turns out that for the first couple of commands the SPI read is ok i.e. the MOSI is high during read. But at some point the situation changes and even when I when I execute a SPI read the Apollo3 seems to do a SPI write with value 0.
See the attached screenshot of the oscilloscope.
The low MOSI during read seems to confe the SD card because the following commands fail then.
Does anyone of you have a clue on that?
I have attached to screenshots of the oscilloscope. Both are captured by executing the code
Code: Select all
The first is as expected. The second seems to be a write. I have already debugged into the AmbiqSuite SDK and in both cases a read is constructed.uint32_t SPI::R(uint8_t cs, uint8_t *data, uint32_t num_bytes) {
uint32_t status = AM_HAL_STATUS_SUCCESS;
memset(&m_xfer_rx,0,sizeof(m_xfer_rx));
m_xfer_rx.ui32NumBytes = num_bytes;
m_xfer_rx.eDirection = AM_HAL_IOM_RX;
m_xfer_rx.pui32TxBuffer = NULL;
m_xfer_rx.pui32RxBuffer = (uint32_t*)data;;
status = am_hal_iom_blocking_transfer(m_iom_handle, &m_xfer_rx);
if(status != AM_HAL_STATUS_SUCCESS)
{
report(status);
return 0;
}
return m_xfer_rx.ui32NumBytes;
Code: Select all
with ui32Dir =1.ui32Cmd = build_cmd(ui32Cmd, ui32Dir, ui32Cont, ui32Offset, ui32OffsetCnt, ui32Bytes);
This is a real blocker for me. So please write me something, even if you don't have any ideas
You do not have the required permissions to view the files attached to this post.