SPI problem PIC32MX250F128D

General discussion on mikroBasic PRO for PIC32.
Post Reply
Author
Message
Kim_H
Posts: 1
Joined: 28 Feb 2016 11:01

SPI problem PIC32MX250F128D

#1 Post by Kim_H » 30 Sep 2020 10:01

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?

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: SPI problem PIC32MX250F128D

#2 Post by filip » 13 Oct 2020 09:02

Hi,

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

Regards,
Filip.

Post Reply

Return to “mikroBasic PRO for PIC32 General”