# sending uint data in spidrv

#### yef smith

Joined Aug 2, 2020
81
Hello , I Have defined
uint8_t B31_B24=0b00000011;
as the command i want to send to my DAC But when i do
SPIDRV_MTransmitB(handle, B31_B24, 8);
it gives me an error of SPIDRV_MTransmitB' makes pointer from integer without a cast. Where did i go wrong?
Thanks

#### MrChips

Joined Oct 2, 2009
22,075
How did you declare handle?

#### yef smith

Joined Aug 2, 2020
81
SPIDRV_HandleData_t handleData;
SPIDRV_Handle_t handle = &handleData;

#### BobaMosfet

Joined Jul 1, 2009
1,224
:: hand to face ::

#### nsaspook

Joined Aug 27, 2009
7,728
You can lead them to ... but you can't make them ...

http://devtools.silabs.com/dl/documentation/doxygen/5.7/efr32mg12/html/group__SPIDRV.html
C:
#include "spidrv.h"

SPIDRV_HandleData_t handleData;
SPIDRV_Handle_t handle = &handleData;

void TransferComplete(SPIDRV_Handle_t handle,
Ecode_t transferStatus,
int itemsTransferred)
{
if (transferStatus == ECODE_EMDRV_SPIDRV_OK) {
// Success !
}
}

int main(void)
{
uint8_t buffer[10];
SPIDRV_Init_t initData = SPIDRV_MASTER_USART2;

// Initialize an SPI driver instance.
SPIDRV_Init(handle, &initData);

// Transmit data using a blocking transmit function.
SPIDRV_MTransmitB(handle, buffer, 10);

// Transmit data using a callback to catch transfer completion.
SPIDRV_MTransmit(handle, buffer, 10, TransferComplete);
}

#### yef smith

Joined Aug 2, 2020
81
Hello, i am confused regarding the pointer issues in the commands bellow.
Did i define the uint data correctly for SPIDRV_MTransmitB and SPIDRV_MReceiveB?
so my recieved data will be stored as uint in Recieved_D ,and the data in B&_B0 will be transferred.
For SENDING:
given uint8_t B7_B0=0b11110000; i want to send it threw my SPIDRV.
SPIDRV_MTransmitB(handle, &B7_B0, 1);

For recieving:
GPIO_PinOutClear(LED_PORT_A,2);
GPIO_PinOutSet(LED_PORT_A,2);

Thanks.

#### BobaMosfet

Joined Jul 1, 2009
1,224
It almost makes me cry when I look inside spidrv.h and see how they've f'd up typedefs... idiots don't know how to correctly define a type! And they certainly don't understand what a Handle actually is.... *sigh* More Hand to Face.

Last edited:

#### yef smith

Joined Aug 2, 2020
81
Hello BobaMosfet,I have found a post from 2019 with a very similar problem to mine.
I am to trying to use SPIDRV in MANUAL CS MODE.
IN the last post the author says that he managed to solve it by changing
My case is Using SPIDRV for a single DAC device I USED USART with PORT E connected to the DAC except one pin wich is port A.

So my question is: If the author is correct.to what value of EMDRV_DMADRV_DMA_CH_PRIORITY i should set it?
Because it gives me a very series warning as shown in the end.
Thanks.

After a lot of trial and error, testing out different things, I finally determined that the dmadrv configuration was the problem. The #define EMDRV_DMADRV_DMA_CH_PRIORITY defaulted to 0. According to the comments in dmadrv_config.h:
https://www.silabs.com/community/mc...g_spidrv_behavesstrangelywhenusingcscont-p3nj