Hello.
I am looking for help attempting to get the BBB to communicate through the SPI bus to a simple SPI slave. I've already done this as "proof" using a TIVAC board.
So, in the AM335x world, starting with the example project:
MCSPI_BasicExample_icev2AM335x_armExampleProject
Which does compile and run. It's not actually talking to the device I'm using... but that's the LEAST of the problems.
(set aside that fact that this example doesn't tell me which pins are being used for MISO or MOSI (SPI0_d0 or SPI0_d1)... Nor can I find anything in and doc to explain that... I can try to decipher that one later...)
So I created a separate test program. I had to drag in a bunch of UART stuff, and GPIO stuff, which is completely unexplained, just to get the linker to resolve everything.
And my test program is crashing on:
spi = SPI_open(0,&spiParams);
So I am comparing it to
MCSPI_BasicExample_icev2AM335x_armExampleProject
First...
The documentation says this about the "SPI_init()" call
"The SPI_config structure must exist and be persistent before this * function can be called."
The example project doesn't have that structure defined ANYWHERE.
I looked through the MAP file, and it appears to be being imported from this:
.rodata.SPI_config
0x800121a0 0x54 C:\ti\pdk_am335x_1_0_7\packages\ti\drv\spi\lib\am335x\a8\release\ti.drv.spi.aa8fg(SPI_soc.oa8fg)
0x800121a0 SPI_config
What purpose does this identifier serve anyway?
The documentation simply provides the completely useless statement:
* The SPI_Config structure contains a set of pointers used to characterize * the SPI driver implementation. * * This structure needs to be defined before calling SPI_init() and it must * not be changed thereafter.
Not much value there. Actually pretty close to NULL...
Next step... Since the structure is in the MAP file of the example program, this identifier is being generated by SOMETHING... Maybe the CFG?
The demo project has this in the CFG file
/* Load the spi package */
var Spi = xdc.loadPackage('ti.drv.spi');
Spi.Settings.socType = socType;
And so does my test project. And there is no other reference to that JAVA object "Spi" anywhere in the example CFG file.
And yet my test project DOESN'T have that identifier in it.
Given two IDENTICAL pieces of CFG code, and one project has a SPI_config identifier, while the other doesn't, should mean that the CFG is NOT be the source of the identifier.
So what IS the source of this identifier ??
On the other hand... maybe the identifier isn't even the reason my test program is crashing. The complete lack of documentation, support, or useful examples leaves me totally lost.
Then other questions I haven't even been able to get to: How are SPIx_d0 and SPIx_D1 mapped to MISO amd MOSI? Where is that controlled?
What is the behavior and timing of SPIx_CS0? Can the active level be set (active_hi or active_low)?
Where is ANY of this actually documented? I must say, the TIVAC dos was a breeze!
If anyone would be willing to assist, it would be appreciated. My "test" project is attached.