MC33664 - readSPI

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MC33664 - readSPI

182 Views
Patrick_Pavle
Contributor III

Dear Community,

I use an ESP32 as MCU, MC3364 and MC33771B
I program the ESP32 on the Arduino IDE. For receiving the message I use the library #include <ESP32SPISlave.h> from GitHub - hideakitai/ESP32SPISlave: SPI Slave library for ESP32 .

i have used the example code "queue_multiple_transactions_and_poll_all_results_slave" as a template and want to output the received data.

I have the problem that my code only outputs the echo above the serial monitor but not the actual response from the MC33771B.

I measure and see on the oscilloscope that both are received. 

my code to receive:

if (slave.hasTransactionsCompletedAndAllResultsHandled()) {
Serial.println("initialize rx buffers");
memset(rx_buf, 0, Rbuffer_size);
slave.queue(NULL, rx_buf, Rbuffer_size);
slave.trigger();

// Serial.println("wait for the completion of the queued transactions...");
}


// if all transactions are completed and all results are ready, handle results
if (slave.hasTransactionsCompletedAndAllResultsReady(QUEUE_SIZE)) {

// get received bytes for all transactions
const std::vector<size_t> received_bytes = slave.numBytesReceivedAll();

Serial.println("Received Data:");
for (size_t i = 0; i < Rbuffer_size; ++i) {
Serial.print("0x");
if (rx_buf[i] < 0x10) {
Serial.print("0");
}
Serial.print(rx_buf[i], HEX);
Serial.print(" ");
}
Serial.println();

memset(rx_buf, 0, Rbuffer_size);
}

0 Kudos
Reply
1 Reply

159 Views
JozefKozon
NXP TechSupport
NXP TechSupport

Dear Patrick,

please share your schematic with voltage levels and part values. Please refer to the section 10.1 in the MC33771B datasheet. At the beginning there is a CID=0000. You need to change it to some other value. E.g. to 0001. Have you changed the CID?

JozefKozon_0-1711614057318.png

With Best Regards,

Jozef

0 Kudos
Reply