How to use FX3 SPI and UART in same firmware ?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
prchc_3505471
Level 2
Level 2
First like given

Hi All,

Can anybody please let me know how to use SPI and UART same time in firmware ?

As FX3 datasheet shows on its 'Pin Description' table that if we choose "16 - bit Data Bus + UART+SPI+I2S", then both SPI pins (GPIO[53 : 56]) and UART pins (GPIO[46 : 49] will be separate and we can use both peripherals in our firmware. Please refer attached datasheet snap shot.

But which mode we have to set as per its API framework for IO matrix configuration as shown below here:

typedef enum CyU3PIoMatrixLppMode_t

{

    CY_U3P_IO_MATRIX_LPP_DEFAULT = 0,   /**< Default LPP mode where all peripherals are enabled. */

    CY_U3P_IO_MATRIX_LPP_UART_ONLY,     /**< LPP layout with GPIF 16-bit and UART only. */

    CY_U3P_IO_MATRIX_LPP_SPI_ONLY,      /**< LPP layout with GPIF 16-bit and SPI only. */

    CY_U3P_IO_MATRIX_LPP_I2S_ONLY,      /**< LPP layout with GPIF 16-bit and I2S only. */

    CY_U3P_IO_MATRIX_LPP_NONE           /**< FX3S specific configuration where UART, SPI and I2S are disabled. */

} CyU3PIoMatrixLppMode_t;

I have tried LPP_DEFAULT, it doesn't work, because it is with 32bit GPIF. Then others are UART only, SPI only. But what if I need to use SPI and UART both ??

Any help will be highly appreciable.

Thanks,

Premji

0 Likes
1 Solution

I think I got clue that why it not working because when I select LPP_DEFAULT,  uart rx tx pins are now at gpio48 and 49, while fx3 ss explorer kit hardware gives uart fixed on gpio 55 and 56.

So to get debug print,  I need to use ttl to usb2. 0 converter which will connect at corresponding header pin on ss kit.

Thanks.

View solution in original post

0 Likes
4 Replies
Hemanth
Moderator
Moderator
Moderator
First like given First question asked 750 replies posted

Hello Premji,

With 32 bit GPIF bus width you cannot get both UART and SPI.

If you need SPI and UART then configure GPIF to 16 bit wide and choose LPP_DEFAULT as the lpp mode. Then you should be getting the configuration as you have marked in the attachment.

Regards,

Hemanth

Hemanth
0 Likes

Hi Hemanth,

Thanks for reply,

I have used that only LPP_DEFAULT mode with 32bit false, uart true,  spi true, even kept i2s true.  But then debug print got stopped which earlier coming with LPP_UART_ONLY mode.

Actually I expected that with LPP_DEFAULT mode, I will be able to both uart on gpio 46 to 49 and spi on gpio 53 to 56. But then simply uart stopped print.

Can you please tell me what mistakes I am doing?

Thanks,

Premji

0 Likes

I think I got clue that why it not working because when I select LPP_DEFAULT,  uart rx tx pins are now at gpio48 and 49, while fx3 ss explorer kit hardware gives uart fixed on gpio 55 and 56.

So to get debug print,  I need to use ttl to usb2. 0 converter which will connect at corresponding header pin on ss kit.

Thanks.

0 Likes

Hello Premji,

Yes that is the reason.

Regards,

Hemanth

Hemanth
0 Likes