Hi Ben
I have a board with an pic24ep256. It's working fine.
The delay time is exactly and the IRQ time is exactly.
The clock from the CPU is 80Mhz.
I use a software SPI with a divider Fosc/2
If I measure the clock is only 760kHz.
I need a 2.5Mhz clock.
How can I understand what FC is doing with this clock divider and how can I change it?
PIC24EP256 SPI Speed to slow
-
- Valued Contributor
- Posts: 654
- Joined: Fri Aug 19, 2016 2:09 pm
- Location: switzerland
- Has thanked: 182 times
- Been thanked: 179 times
- Contact:
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: PIC24EP256 SPI Speed to slow
Hi,
For the software SPI, the Prescale value determines the number of nop to use as a delay.
If you want to try a faster clock then you will need to edit PIC16BIT_CAL_SPI.c
Have a look at lines 324 and 351 where MX_PRESCALE_VAR_X is use as a Clock delay
As a suggestion, try removing the for loop, such that only one nop is used ...
For the software SPI, the Prescale value determines the number of nop to use as a delay.
If you want to try a faster clock then you will need to edit PIC16BIT_CAL_SPI.c
Have a look at lines 324 and 351 where MX_PRESCALE_VAR_X is use as a Clock delay
As a suggestion, try removing the for loop, such that only one nop is used ...
Code: Select all
//Clock delay
// for (i=0; i<MX_PRESCALE_VAR_X; i++)
nop();
-
- Valued Contributor
- Posts: 654
- Joined: Fri Aug 19, 2016 2:09 pm
- Location: switzerland
- Has thanked: 182 times
- Been thanked: 179 times
- Contact:
Re: PIC24EP256 SPI Speed to slow
Hi Leigh
Thank you for the additional infos. I removed the "for loop" and it's 20% faster.
Thank you for the additional infos. I removed the "for loop" and it's 20% faster.