MQX 4 SPI Problem TWR-K60F120M

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

MQX 4 SPI Problem TWR-K60F120M

跳至解决方案
2,824 次查看
terencet
Contributor III

I've been trying to get SPI working in MQX.

I have already got it working bare metal by just writing to the addresses, and thought that I could just use the same code in MQX.

I have connected up SPI1 and SPI2 using the Prototyping board and am just sending one byte messages one way. When I try to get it to work in MQX I can see that the messages are being sent but nothing is happening on the receiving side. This also happens when I try to use MQX's SPI driver, I get the exact same problem. I've noticed that in both I can't seem to change the PCSIS value in the MCR register it is always 0xFF no matter what I set it to(I can change it in the baremetal version).

Has anyone experienced any similar problems or know what might be causing this?

I'm using keil's uVision 5 and the TWR-K60F120M board.

标记 (4)
0 项奖励
回复
1 解答
2,551 次查看
terencet
Contributor III

So I revisited this recently and started again using the same code I was using before and I was able to get both working just by writing to the registers. I have absolutely no idea why it wasn't working I'm pretty sure I'm using the exact same stuff as I was before there are a few small problems now but they don't seem to be related to what ever problem I had.

Most likely I was just being very very stupid and missed something very obvious.

在原帖中查看解决方案

0 项奖励
回复
4 回复数
2,552 次查看
terencet
Contributor III

So I revisited this recently and started again using the same code I was using before and I was able to get both working just by writing to the registers. I have absolutely no idea why it wasn't working I'm pretty sure I'm using the exact same stuff as I was before there are a few small problems now but they don't seem to be related to what ever problem I had.

Most likely I was just being very very stupid and missed something very obvious.

0 项奖励
回复
2,551 次查看
terencet
Contributor III

OK For some reason I'm not to sure why I have been able to get SPI communication working.

SPI1 works using the SPI driver but not by writing directly to the registers.

SPI2 works by writing directly to the registers but not by using the SPI driver.

This seems absolutely bizarre I'm checking through the MQX source to see if I can find anything but so far it hasn't turned up anything. If anyone can think of a reason why this would be happening I'd love to know but for the mean time I'll just work with what I have.

0 项奖励
回复
2,551 次查看
terencet
Contributor III

Ok so I got messages sending and receiving by setting PCSIS to 0xC0 (it still wont go to 0) but all I'm getting on the other end is rubbish. Will update if I can solve it but I'd really like to know why I can't set PCSIS to 0, is it something MQX sets up and then can't be changed?

Any help would be appreciated.

0 项奖励
回复
2,551 次查看
terencet
Contributor III

I've just noticed that the two bits that are set in 0xC0 are actually reserved bits not part of PCSIS.

Does anyone know why these would be set in MQX?

I just checked and they definitely are clear in the bare metal version and that is the only difference between the two versions.

0 项奖励
回复