EN / USD
32
of 76
TEP , The Engineering Projects , Image

syedzainnasir

TEP , The Engineering Projects , Rating 7.5 7.5 / 10
TEP , The Engineering Projects , Icon Level: Moderator
TEP , The Engineering Projects , Icon Joined: 20 Mar 2022
TEP , The Engineering Projects , Icon Last Active: 2:21 PM
TEP , The Engineering Projects , Icon Location: TEP , The Engineering Projects , Flag
TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon
PIC32MMGPL028 - Pauses in SPI transfer in 8bit and 16bit mode
TEP , The Engineering Projects , Calender Question: 06-Mar-2017
TEP , The Engineering Projects , Category In: PIC Microcontroller Projects
i am currently evaluating some PIC32MM devices.
For a Testproject, i want to control some SK6812 - LED (wich are WS2812 compatible).
Those require a strict timing. I use the SPI of the PIC, using a 8MHz Clock (using the PLL for 16MHz system clock). In theory, it is possible to achive the WS2812 timing.

I got a small SPI Problem there:
I can achive the timing only, if i use the SPI in 32bit-Mode. In 8bit or 16 bit-mode, i get constant "pauses" between two transfers.
See attached picture. For the picture, i am constantly writing 8bit 0xAA. Channel1 is data, Channel2 is clock.

The main loop consists of [code] LATBbits.LATB2 = 1; SPI2_RXTX_EBUF_8bit(0xAA); LATBbits.LATB2 = 0;[/code] Thats all. I use the Port B2 for timing tests.

My SPISettomgs: [code] //init SPI SPI2CON = SPI2CON2 = 0; SPI2CONbits.MODE16 = 0; //1 for 16bit mode SPI2CONbits.MODE32 = 0; //1 for 32bit mode SPI2CONbits.CKE = 0; SPI2CONbits.CKP = 1; SPI2CONbits.ENHBUF = 1; set->Baudrate = SPI2_Setbaud(set->Baudrate, pCLK); SPI2CONbits.MSTEN = 1; SPI2STATbits.SPIROV = 0; SPI2CONbits.ON = 1;[/code] I use the following for transfer: [code]inline uint8_t SPI2_RXTX_EBUF_8bit(uint8_t data){ while(SPI2STATbits.SPITBF); SPI2BUF = data; return SPI2BUF; }[/code] Tools:
- XC32 v 1.4
- MPLABX 3.51
- PICkit 3 (also for power)

The SPI-Code works fine on a PIC32MX470 and PIC32MX250. I dont remember any pauses from previous projects with PIC32 MX devices.

What am I doing wrong here?
Thanks for any help in advance!
TEP , The Engineering Projects , Icon Answer: 0 TEP , The Engineering Projects , Icon Views: 150 TEP , The Engineering Projects , Icon Followers: 85
Small Bio
TEP , The Engineering Projects , Tags
PLC
Robot
STM32
Arduino
AI
ESP32
Ladder Logic
PLC Projects
Programming
Communicates STM32
PLC Projects
Communicates PLC
Font Style
Alignment
Indenting and Lists
Insert Media
Insert Items

Want to leave an answer!

Word Count :0 Draft Saved at 12:42 am.