Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By Vicne
#62934
supriono wrote:i want to cek data SPI from device like this (esp is slave)
Image

how to print uint8_t * data (biner) to scope
Code: Select all    SPISlave.onData([](uint8_t * data, size_t len) {
        Serial.println(data,BIN);
    }
    );

i have this error

exit status 1
call of overloaded 'println(uint8_t*&, int)' is ambiguous


Hi,

Sorry, I'm not sure I understand the question.
First, you say you want to print the bytes "to scope". Serial.println() will send characters to the serial port, not to a "scope". If you pass an integer (e.g. 78) as first parameter and "BIN" as the second parameter, it will convert the integer to binary (1001110), then create a string with those 7 characters (seven times either '0' or '1') and send them to the serial port, so that the client on the other side will receive that string to, for example, display it in the terminal. If that's what you want, the 2-parameter Serial.println() is the right call.
Second, "data" is a "uint8_t *", that is a pointer to an unsigned int (or array of unsigned int), and there is no implementation of "Serial.println()" that expects a pointer to an unsigned int as first parameter and the constant (BIN) as second parameter. That's why you receive an error. What you probably want to do is dereference the pointer first, either using the "*" operator or, if it is part of an array, by indicating the element number between brackets.

Here is a full sketch illustrating the above :

Code: Select allvoid setup() {
  Serial.begin(115200);
  uint8_t a[] = {78,79,80};
  printBin(a);
}

void loop() {}

void printBin(uint8_t* a) {
/* This does not compile because the compiler does not know how to print a pointer to uint8_t as you have noticed */
//  Serial.println(a, BIN);
//  Serial.println();

/* This works and prints (in binary) the value of the uint8_t pointed to by a */
  Serial.println(*a, BIN);
  Serial.println("--------");
 
/* This works and prints (in binary) the value of the first element of a, considered as an array (same result) */
  Serial.println(a[0], BIN);
  Serial.println("--------");

/* This works and prints(in binary)  the value of the 2nd and 3rd elements of a, considered as an array */
  Serial.println(a[1], BIN);
  Serial.println(a[2], BIN);
  Serial.println("--------");

/* This works and prints the value of all elements of a, considered as an array (same result as the 3 calls before) */
  for (int i = 0; i < 3; i++) {
    Serial.println(a[i], BIN);
  }
  Serial.println("--------");
}


The output on the serial monitor is :
Code: Select all1001110
--------
1001110
--------
1001111
1010000
--------
1001110
1001111
1010000
--------


In other words, change
Serial.println(data,BIN);
to
Serial.println(*data,BIN);
and you will print the value of the first byte in "data".

Hope it helps

Vicne
User avatar
By doru.cazan
#63895 Hi all,

I am asking for your help after several days without success solving this issue: how can I get and process (e.g log to Serial port) every bit of data received over SPI by a SPI-slave Esp8266 (Esp12E)? Every bit received includes command, address, status, data... every bit (-:

I need this so I can replace an LCD display in an existing device with Esp8266 and send over WiFi the information normally appearing on screen.

Device: Velux KLR 100
Device CPU: V850ES/JG2
Display controller: EM6126

I already received and decoded the information using chipKIT Uno32 (PIC32MX320F128H) but no WiFi and I would like, if possible, to use only one, smaller module/board.

From EM6126 datasheet, 8.2 Serial interface:

The serial interface consists of 3 wires: Chip Select CS, Serial Clock SCL and Serial Data SDA. The information is exchanged byte-wide and is shifted serially in the LCD driver at SCL falling edge.
Transfer data direction is from microcontroller to EM6126. When CS is activated at low level, the communication is enabled and CS must stay low for the rest of the transmission.


I read in ESP8266 Technical Reference that using only DATA (no COMMAND or ADDRESS) is not supported yet but I hope that there is a way to overcome this.

I am using Arduino IDE so information related with that will help me more, but I appreciate any kind of help.

Thanks a lot!
User avatar
By Jocc
#73406 Hi All!

Is it possible to use the SPISlave library to receive 16 bit data?
I'm programming the ESP8266 with Arduino IDE, to be an SPI slave. The master is a Xilinx FPGA, which sends 2048 pieces of 16bit data with 1 MHz SPI frequency.
Where can I set spi mode to 16 bit?