No SPI output on the pins?
Posted: Fri Aug 15, 2008 3:57 pm
Dear List,
I am having a strange problem with the SPI
Input/Output block (only used for output in this case).
The code generated by the block seems to be correct, but the
call to WriteSPI1() does not actually drive an output on the pins.
I don't, of course, know what WriteSPI1() actually does. Replacing
it in the generated code with a call to this function works for me:
void my_write_spi(uint16_T value)
{
uint16_T dummy;
if (SPI1STATbits.SPIRBF)
dummy = SPI1BUF;
while (SPI1STATbits.SPITBF)
;
SPI1STATbits.SPIROV = 0;
Nop();
SPI1BUF = value;
} /* End of function my_write_spi() */
Can you suggest what may be going on? I will send copies of the
generated code for a small demonstration model if you like.
I am a software developer working for a small company in England which
produces HIL (hardware-in-the-loop) solutions for various enterprises,
particularly car manufacturers. We want to offer our customers the ability
to generate custom code to run on our hardware, and the dsPIC block-set
looks like a very useful tool. If we get past our current problems, our
customers will become potential customers for the block-set too, but we
need to make it as easy as possible for them.
Bernard Leak.
I am having a strange problem with the SPI
Input/Output block (only used for output in this case).
The code generated by the block seems to be correct, but the
call to WriteSPI1() does not actually drive an output on the pins.
I don't, of course, know what WriteSPI1() actually does. Replacing
it in the generated code with a call to this function works for me:
void my_write_spi(uint16_T value)
{
uint16_T dummy;
if (SPI1STATbits.SPIRBF)
dummy = SPI1BUF;
while (SPI1STATbits.SPITBF)
;
SPI1STATbits.SPIROV = 0;
Nop();
SPI1BUF = value;
} /* End of function my_write_spi() */
Can you suggest what may be going on? I will send copies of the
generated code for a small demonstration model if you like.
I am a software developer working for a small company in England which
produces HIL (hardware-in-the-loop) solutions for various enterprises,
particularly car manufacturers. We want to offer our customers the ability
to generate custom code to run on our hardware, and the dsPIC block-set
looks like a very useful tool. If we get past our current problems, our
customers will become potential customers for the block-set too, but we
need to make it as easy as possible for them.
Bernard Leak.