Other Parts Discussed in Thread: SYSCONFIG, C2000WARE
Tool/software:
Hi,
I'm trying SPI communication between TMS320F28388D and MB4 iC. TMS320F28388D works as SPI master, and MB4 works as SPI slave.
The picture below is the MB4 SPI protocol and the OP codes for Register READ/WRITE from the iC MB4 datasheet.
(iC MB4 datasheet download link : https://www.ichaus.de/product/ic-mb4/#documents)
This is the information on the register I want to access to.
I want to set SLAVELOC5 to 1, so I tried writing 0x10 to the Register with the address 0xEC.
I set the sysconfig and wrote a code to make this SPI protocol. What I did was write 0x10 to the register, and then read the register value.
/*Included Files*/
#include "driverlib.h"
#include "device.h"
#include "board.h"
#include <stdio.h>
//OP CODE
#define WR_REG 0x02
#define RD_REG 0x03
#define RD_STS 0x05
#define WR_INS 0x07
//Register Addr
#define SLAVELOC5 0xEC
/*private code*/
#define nData 3
uint16_t TxData[nData] = {0,};
uint16_t RxData[nData] = {0,};
uint32_t txData = 0;
uint16_t txDelay = 0;
/*Main*/
void main(void)
{
/*start settings*/
// Initialize device clock and peripherals
Device_init();
// Disable pin locks and enable internal pullups.
Device_initGPIO();
// Initialize PIE and clear PIE registers. Disables CPU interrupts.
Interrupt_initModule();
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
Interrupt_initVectorTable();
// Board initialization
Board_init();
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
EINT;
ERTM;
/*USER CODE*/
while(1)
{
TxData[0] = WR_REG;
TxData[1] = SLAVELOC5;
TxData[2] = (uint16_t) 1U << 4;
txData = ((uint32_t)TxData[0] << 16U) | ((uint32_t)TxData[1] << 8U) | (uint32_t)TxData[2];
SPI_transmit24Bits(mySPIA_BASE, txData, txDelay);
TxData[0] = RD_REG;
TxData[1] = SLAVELOC5;
txData = ((uint32_t)TxData[0] << 16U) | ((uint32_t)TxData[1] << 8U) | (uint32_t)TxData[2];
SPI_transmit24Bits(mySPIA_BASE, txData, txDelay);
}
}
//
// End File
//
And I got this weird-looking MISO signal.
I first thought that the reason I got this signal was because I only have access to BIT 4 of the register however, writing 0x10 makes it access to other bits of the register as well.
So I also tried writing 0x11(=0b00010001) because I thought it might keep the BIT 0 value to '1'. However, the result was the same.
But I think it's not because the datasheet says that ' Register bits with constant ’0’ or ’1’ are ROM-based values and can not be changed through writing.' and I think writing 0x10 does not change the value of other registers that has values '0'.
And I also tried setting MISO line to 'Push-pull output/pull-up enabled on INVERTED input' as I know this means 'Pull-down'.
But when I set the MISO to pull-down, I got a more weird signal.
The MISO suddenly worked as ACTIVE LOW.
To sum up,
1. What's the problem with my SPI? Is it the code problem, or sysconfig setting problem? Or my misunderstanding of MB4 SPI protocol or settings?
2. Why does MISO work weirdly when I set it to 'Push-pull output/pull-up enabled on INVERTED input'?
3. Does 'Push-pull output/pull-up enabled on INVERTED input' mean Pull-down?
3. How can I solve this problem?