Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

is it possible to do general SPI with ESP8266 NodeMCU from efr32

Status
Not open for further replies.

yefj

Advanced Member level 5
Advanced Member level 5
Joined
Sep 12, 2019
Messages
1,502
Helped
1
Reputation
2
Reaction score
5
Trophy points
38
Activity points
9,091
Hello, this post is more suited to this forum although it started as a general question regarding transmitter in RF forum.
I have ordered the device shown bellow, and i saw in the internet that its absolutely built for ARDIONO.
All manual are for ardiono.
Is there a way i could use this great device with general spi HEX commands with EFR32?
Is there some manual like that?
Thanks.
 

Hi,

SPI can be done with any microcontroller I know.
Most of them include SPI hardware periferal, but in case they don't have you can generate software bit bang SPI.

But again you are not clear with your post. I'm sure there are more than 10.000 software examples for ARM with code that does SPI communication.
We don't know what information you miss..

Klaus
 
  • Like
Reactions: yefj

    yefj

    Points: 2
    Helpful Answer Positive Rating
Hello Klauss, if you remmember i used to communicate with DAC80004 uisng pure HEX commands.
I had a big table of commands and i have send SPI sequenced to the device using MOSI and it worked accordingly.

I have read the reference manual of the device and there is no such table ,only an API for a library they made.
I want to communicate by HEX commands and pure SPI as i did till now.

If its not an option i will start reading abut bitbanging you mentioned.
Thanks.

1605510165607.png
Hi,

SPI can be done with any microcontroller I know.
Most of them include SPI hardware periferal, but in case they don't have you can generate software bit bang SPI.

But again you are not clear with your post. I'm sure there are more than 10.000 software examples for ARM with code that does SPI communication.
We don't know what information you miss..

Klaus
 

Any problem to send your "HEX commands" to pInData of the API call? It hardly cares if the data is assembled of hexadecimal literals or e.g. calculated values.
 

Hi,

I still don't see what's the problem.

HEX, binary, decimal, octal ... all is the same for the microcontroller ... they are just different ways to represent the value.
All data you want to send via SPI you need to put into an array of bytes according documentation.
--> Read about SpiData / pInData.

Klaus
 
Last edited:

Hello Klauss,my big goal is to read data from a sensor and then send it to the ESP8266 so it whould be broadcast it.
So if i imagine its,i should tell the ESP8266 whatmodulation i want ,what frequency i want etc..
and i need to have a Hex command which i send my digital 20bits of data from EFR32 to ESP8266 ,so it will be broadcased.


in the reference manual they are presenting functions like SPI bit order etc.. so you say i have to program ESP8266 controller by their libraries and their software (to set the SPI definition)

But then the most crutial part of how EFR32 controller will talk to ESP8266.
What chapter of the ESP8266 manual handles the defining of MOSI HEX commands .
Thanks.

1605516715693.png
 

Sounds like you want to do hand typed hex commands at a keyboard/terminal
or sending custom commands via scripts/code ? Can you clarify ?

Insofar as broadcasting data here is example -


Google "esp8266 network topology", many hits

Generally speaking this is IP approach.



Regards, Dana.
 


So basically the efr32 would issue your desired hex command and the ESP8266 would interpret it.

So you would code a command set, define it, what it does, and that would comprise the ESP8266
interpreter coding. Say for example I want to trigger PWM inside ESP8266. I would have code running in ESP8266
that receives data (commands) from the efr32. When data (command) is received the code decides if its
a PWM start command, if so start the PWM.

So in short on efr32 side you issue commands over the wireless link, and the ESP8266 receives the commands
and decides what it is supposed to do with the command. Fairly simple codling I would think. You start with a
example link code efr32 and for ESP8266, and modify those examples to implement the command functionality.

Note you may want to consider using ESP32 versus efr32, as the ESP32 and ESP8266 share the same IDE and
many of the libraries. Just a thought.

Regards, Dana.
 

    yefj

    Points: 2
    Helpful Answer Positive Rating
Hello Dana, So unlike DAC80004 i need to build my own SPI table :)
Thanks.
 

So you want to do this wired thru SPI versus wireless ?

If so you would use example projects for both parts to run a SPI link, eg. data transfer and
wire their spi ports up to each other. Then mod the projects to add the code on ESP8266
side to interpret data received, and mod code on EFR32 side to transmit desired commands.

When you do coding you need to create a protocol for your commands, like send a command,
ESP8266 acknowledges it, and then executes it. If ESP8266 does not acknowledge getting command
and executing this, you also need code for error recovery.

ESP8266 SPI example - https://diyi0t.com/spi-tutorial-for-arduino-and-esp8266/


Regards, Dana.
 
Last edited:
  • Like
Reactions: yefj

    yefj

    Points: 2
    Helpful Answer Positive Rating
--> Read about SpiData / pInData.
It seems you don´t want to do it on your own.

Out of curiosity I´tried an internet search. It took me less than 10 seconds to find:
Code:
/**
 * @brief SPI data package
 */
typedef struct {
    uint16_t    cmd;            ///< Command value
    uint8_t     cmdLen;         ///< Command byte length
    uint32_t    *addr;          ///< Point to address value
    uint8_t     addrLen;        ///< Address byte length
    uint32_t    *data;          ///< Point to data buffer
    uint8_t     dataLen;        ///< Data byte length.
} SpiData;
..in a document about the (your) C library...

I´m out.

Klaus
 

    yefj

    Points: 2
    Helpful Answer Positive Rating
Hello Klauss ,You did not understand me correctly.
I thought i could manage without learning the syntax of ESP2866 SPI,i thought its a device like DAC80004.
Thanks for the help i will start learning how to program this controller.
Thanks.
--- Updated ---

Hello Dana,from the manual you presented, In the print screen shown bellow, they say that it cannot act as a slave :-( is it true?
Its a bad news for me because i need it to wait for a command from efr32.
Can it be a slave?
Thanks.

1605554771204.png
 
Last edited:

Hello Klauss ,You did not understand me correctly.
Yes. Correct.
Because you don't answer questions. Jump from one item to to the next without clarifying the doubts before.
Just vague informations.

One example: You say
read data from a sensor
but don't say which sensor, nor which commands, nor give a link to a datasheet.

It's like asking: "I want to send a parcel. How much do I have to pay?"
Without giving informations about size, weight of the parcel, without giving destination.
It could be small, it could be heavy and big. It could be to the next door, it could be 4000km over the sea.

This way it's impossible to give good assistance. I want to help members ... that show effort and ask questions to clarify doubts.

It's demotivating. I know I just should stop to respond ... but this will not help you either

Klaus
 
I'll try to be more informative.
Thanks for the patients.
 

I think the confusion is who is boss and who is servant. The ESP8266 is an MCU with an SPI interface, it isn't an SPI slave device at all.

The data flow would be:
Device <-->(SPI data)<-->ESP8266 ~~~~~ (Wifi link) ~~~~~ ESP8266<-->(SPI data)<-->EFR32
The RED part can be any protocol you choose, including SPI, I2C, Serial or to some extent parallel.

One ESP8266 would be set to STA mode, the other to APP mode so they make their own WiFi link without needing a router or other network connection. The frequency can only be adjusted by selecting channels within the allowed 2.4GHz band.

The ESP8266 is a powerful device, it can probably do any data processing on the fly before passing it to the EFR32. Depending upon your application it may even be possible to use the EFR32 directly from the WiFi without needing the second ESP8266 at all or you might even us an EFR32 at both ends of the link.

Brian.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top