...I have tried opening JP27 but it still got the same result. I try to use mikroBUS B (SPI1) but it seems can not worked in PIC24FJ1024GB610 PIM module (Pin_SPI1.png)
Sorry about my initial comment about JP27. It is irrelevant here.
The thing is: Please look at my table. (Better, yet, look at the schematics for the Explorer and the PIM.) If you are going to use mikroBUS position B
, you have the WRONG (really, WRONG
) pin assignments. G6, G7, G8, and G9 are for mikroBUS position A
Look at the PIM schematic and look at the Explorer schematic. PGD and PGC to the PIM connector on the Explorer are at pins 26 and 27. On the PIM you can see that they to go RB6/PGEC2 and RB7/PGED2. Change those assignments also. You can do it on the System Module "Easy Setup" window or on the Pin Manager "Grid View" window.
Finally, in your code for reading and writing the SPI device you manipulate LATG9. As I have mentioned (twice now) that is the wrong pin. Just as important from a program debugging and maintainability point of view, I think it would be better to use a name that you defined in the MCC Pin manager. In your first picture you called it Accel3_nCS. I like it.
I would set the "Custom name" for the correct chip select to that, then in the SPI read write functions, I would put
Besides being more obvious, it makes it easy to change the pin if you want to use a different signal: Just change the assignment in the MCC pin manager, and you won't have to touch the application source code.
post edited by davekw7x - 2018/11/13 00:28:56