Page 1 of 1

SPI problem PIC32MX250F128D

Posted: 30 Sep 2020 10:01
by Kim_H
Hi,

I have a strange problem with SPI1 when i enable USB HID.

This works:

' Initialize SPI1 module SD Card
SPI1_Init_Advanced(_SPI_MASTER, _SPI_8_BIT, 80, _SPI_SS_DISABLE, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_HIGH, _SPI_ACTIVE_2_IDLE)

SPI1_Write(0xb0)

Delay_ms(1000)

' Initialize USB HID
USBIE_bit = 1
USBIP2_bit = 1 ' Interrupt priority 7
USBIP1_bit = 1 ' Interrupt priority 7
USBIP0_bit = 1 ' Interrupt priority 7

' Enable all interrupts
EnableInterrupts
HID_Enable(@HidReadBuff, @HidWriteBuff) ' Enable USB HID communication.



This Does not work:

' Initialize USB HID
USBIE_bit = 1
USBIP2_bit = 1 ' Interrupt priority 7
USBIP1_bit = 1 ' Interrupt priority 7
USBIP0_bit = 1 ' Interrupt priority 7

' Enable all interrupts
EnableInterrupts
HID_Enable(@HidReadBuff, @HidWriteBuff) ' Enable USB HID communication.

Delay_ms(1000)

' Initialize SPI1 module SD Card
SPI1_Init_Advanced(_SPI_MASTER, _SPI_8_BIT, 80, _SPI_SS_DISABLE, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_HIGH, _SPI_ACTIVE_2_IDLE)

SPI1_Write(0xb0)

When SPI1 is initialized after HID_Enable function it blocks the SCLK output but MOSI works?


If i move the project to another Microcontroller PIC32MX534F064H that is used on PIC32MX clicker, both versions work!
Any suggestions?

Re: SPI problem PIC32MX250F128D

Posted: 13 Oct 2020 09:02
by filip
Hi,

I apologize for the late reply, have you been able to sort out this issue ?

Regards,
Filip.