Feb 28, 2019
01:07 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Feb 28, 2019
01:07 AM
Hi!
I'm trying to run the example code for the xmc4800 automation board whit the 6 pin user header. I've set the spi pin as following (only for output stage):
#define DO_SPI_MISO P3_12
#define DO_SPI_MOSI P3_11
#define DO_SPI_SCLK P3_13
#define DO_SPI_SS P4_3
then, i use the usic2_ch1 for the communication with the external iso module
The ODIS of the external isoface is directly connected to 3.3V, so the outputs are supposed enabled. I'm usign an ISO1H812G
The problem is that the outputs are always off, so i can't communicate with the external module. Am i doing something wrong in the code?
I'm trying to run the example code for the xmc4800 automation board whit the 6 pin user header. I've set the spi pin as following (only for output stage):
#define DO_SPI_MISO P3_12
#define DO_SPI_MOSI P3_11
#define DO_SPI_SCLK P3_13
#define DO_SPI_SS P4_3
then, i use the usic2_ch1 for the communication with the external iso module
void ISOout_INIT(void)
{
//ISOout_OUT_OFF(&ISOout_ODIS);
/*Initialize and Start SPI*/
XMC_SPI_CH_Init(XMC_SPI2_CH1, &do_spi_config);
XMC_SPI_CH_SetBitOrderMsbFirst(XMC_SPI2_CH1);
XMC_SPI_CH_SetWordLength(XMC_SPI2_CH1, (uint8_t)16);
XMC_SPI_CH_ConfigureShiftClockOutput(XMC_SPI2_CH1,XMC_SPI_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_0_DELAY_ENABLED,XMC_SPI_CH_BRG_SHIFT_CLOCK_OUTPUT_SCLK);
/*Input source selected*/
XMC_SPI_CH_SetInputSource(XMC_SPI2_CH1,XMC_SPI_CH_INPUT_DIN0,USIC2_C1_DX0_P3_12);
XMC_SPI_CH_Start(XMC_SPI2_CH1);
/*GPIO configuration*/
XMC_GPIO_SetMode(DO_SPI_MOSI, XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT1);
XMC_GPIO_SetMode(DO_SPI_SS, XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT1);
XMC_GPIO_SetMode(DO_SPI_SCLK, XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT1);
XMC_GPIO_SetMode(DO_SPI_MISO, XMC_GPIO_MODE_INPUT_TRISTATE);
}
void Set_ISOout(uint16_t value)
{
uint16_t OutData = 0x00 | value;
/*Enable Slave Select line 0*/
XMC_SPI_CH_EnableSlaveSelect(XMC_SPI2_CH1, XMC_SPI_CH_SLAVE_SELECT_2);
/*Sending a byte*/
XMC_SPI_CH_Transmit(XMC_SPI2_CH1, OutData, XMC_SPI_CH_MODE_STANDARD);
/*Wait till the byte has been transmitted*/
while((XMC_SPI_CH_GetStatusFlag(XMC_SPI2_CH1) & XMC_SPI_CH_STATUS_FLAG_TRANSMIT_SHIFT_INDICATION) == 0U);
XMC_SPI_CH_ClearStatusFlag(XMC_SPI2_CH1, XMC_SPI_CH_STATUS_FLAG_TRANSMIT_SHIFT_INDICATION);
/*Disable Slave Select line */
XMC_SPI_CH_DisableSlaveSelect(XMC_SPI2_CH1);
XMC_SPI_CH_GetReceivedData(XMC_SPI2_CH1);
}
The ODIS of the external isoface is directly connected to 3.3V, so the outputs are supposed enabled. I'm usign an ISO1H812G
The problem is that the outputs are always off, so i can't communicate with the external module. Am i doing something wrong in the code?
- Tags:
- IFX
2 Replies
Mar 11, 2019
03:00 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mar 11, 2019
03:00 PM
Hi,
Did you try with the contributed APPs for the ISO devices?
Regards,
Jesus
Did you try with the contributed APPs for the ISO devices?
Regards,
Jesus
Mar 18, 2019
02:59 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mar 18, 2019
02:59 AM
Hi!
I've solved the problem, there was a wrong hardware connection. But now i have another problem, i can't read the data from the spi loop back. I've connected several modules in daisy chain and transmission is ok, but when i try to read from the spi i always get 0xFFFF. The RBUF is always 0xFFFF.
I'm in half duplex mode, because i'm using only the XMC_SPI2_CH1 channel.
My configuration is:
baudrate = 1000000,
bus_mode = XMC_SPI_CH_BUS_MODE_MASTER,
selo_inversion = XMC_SPI_CH_SLAVE_SEL_INV_TO_MSLS,
parity_mode = XMC_USIC_CH_PARITY_MODE_NONE
and:
XMC_GPIO_SetMode(DO_SPI_MOSI, XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT1);
XMC_GPIO_SetMode(DO_SPI_SS, XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT1);
XMC_GPIO_SetMode(DO_SPI_SCLK, XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT1);
XMC_GPIO_SetMode(DO_SPI_MISO, XMC_GPIO_MODE_INPUT_PULL_UP);
with the spi pin from the user header of the xmc4800 automation board:
MISO P3_12
MOSI P3_11
SCLK P3_13
SS P4_3
Observing the MISO at the oscilloscope i see the data that i want to read from the spi, so why is the RBUF always 0xFFFF?
I've solved the problem, there was a wrong hardware connection. But now i have another problem, i can't read the data from the spi loop back. I've connected several modules in daisy chain and transmission is ok, but when i try to read from the spi i always get 0xFFFF. The RBUF is always 0xFFFF.
I'm in half duplex mode, because i'm using only the XMC_SPI2_CH1 channel.
My configuration is:
baudrate = 1000000,
bus_mode = XMC_SPI_CH_BUS_MODE_MASTER,
selo_inversion = XMC_SPI_CH_SLAVE_SEL_INV_TO_MSLS,
parity_mode = XMC_USIC_CH_PARITY_MODE_NONE
and:
XMC_GPIO_SetMode(DO_SPI_MOSI, XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT1);
XMC_GPIO_SetMode(DO_SPI_SS, XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT1);
XMC_GPIO_SetMode(DO_SPI_SCLK, XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT1);
XMC_GPIO_SetMode(DO_SPI_MISO, XMC_GPIO_MODE_INPUT_PULL_UP);
with the spi pin from the user header of the xmc4800 automation board:
MISO P3_12
MOSI P3_11
SCLK P3_13
SS P4_3
Observing the MISO at the oscilloscope i see the data that i want to read from the spi, so why is the RBUF always 0xFFFF?