Depending on what you mean by "simultaneously" It's either impossible on your hardware or only possible if you get rid of all the used libraries and implement everything from scratch. The later is necessary if you want to the SPI hardware to run the two buses concurrently so that SPI0 is transferring while SPI1 is also transferring.
My opinion: if you need that little bit additional speed, use faster board. Most probably it's not worth the effort for the minimal speed-up you can get.
I did say ATmega328 and deliberately left out the PB off the end. Your lack of a reply to what sort of Ardunio you are using is more interesting. Are you actually testing a new sort of Arduino that you were not supposed to tell people about?
As per the datasheet, we know that we have 2 independent SPI buses available on ATmega328PB.
We have purchased ATmega328PB for that reason and trying to test this feature on a breakout board before we develop the custom PCB for it.
As mentioned in my post, Both SPI0 and SPI1 work independently but do not work when concurrently. i.e when both SPI0 and SPI1 are trying to transfer data.
OK, so it is not an Arduino, so there is little chance that many people here would have experience with it.
However, there is no need to make a custom board to experiment with this processor. It seems they are available from the major distributors, at not much money, here is one example. atmega328pb evaluation board
My guess at your problem would be the SPI drivers you are using are keeping the interrupts disabled until a transaction has been completed. All very well with only one SPI but not with two.
I assume you have written a core file for this. Want to share it for others that might be interested in this processor? Along with your test code, that shows this problem.
I also think you would be better of in this section of the forum, so I have moved the thread here. To where it mentions "Stand alone or alternative microprocessors" in the title description.
How have you modified the standard ethernet and TLE9879 libraries to support SPI1 on one of them? AFAIK, neither of those is "multiple SPI bus ready."
(In other words, let's see your code, and "what core are you using.")
We have modified and re-written the library for TLE9879 to use SPI1 as the standard library is using SPI0 by default.
We have not modified the library Ethernet. Standard Library is used.
Here are the links to the library.
I think it is there in his git hub repo file, motor_driver.h & motor_driver.cpp. He is including "SPI1.h" in motor_driver.h.
So, in motor_driver.cpp,
He is using the functionality for SPI1, which has been dedicated to TLE9879.
in main.cpp,
He is directly using the functionality for SPI0, which has been dedicated to Ethernet separately.
He has created a pointer of the Motor class, defined in motor_driver.h, into main.cpp and uses that pointer to call functions of the Motor class/TLE9879 library.
Logically, these two are separate SPI bus line communications and should work as expected by the post.
The only question I have is that does HAL layer of the controller really has the capability to treat both buses separately. I am not sure about other reasons as well.
You still didn't tell us what "operating together" exactly means.
What exact limitation do you experience? The processor has only one core so it cannot run two threads at the same time. But it should be possible to transfer a byte on both SPI buses at the same time but as I wrote, that cannot be achieved using the libraries which expects only one SPI bus to exist.
Can you confirm you have used platformIO to open the project? If not you will not be able to see the SPI.h and SPI1.h files. Anyways the headers are the standards from the Arduino framework.
Make sure you open the project from platform Io on VS code.
Can you confirm you have used platformIO to open the project? If not you will not be able to see the SPI.h and SPI1.h files. Anyways the headers are the standards from the Arduino framework.
Make sure you open the project from platform Io on VS code.