-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible to read but can't send data. #48
Comments
Regarding send fail, past issues (closed issues) are helpful. Mostly due to terminating resistors or cable quality. Many people have encountered this problem and solved it by changing the terminator or STAB wire cable. |
I currently have 3 nodes, 2 of them are talking and all has twisted shielded pairs which are 5-10cm in length and the shield is grounded. It's the only device on the network that can't talk. The resistance between CAN_L & CAN_H is ~60 Ohm so that isn't an issue either. I've also checked previous closed issues and tried those aswell. All baudrates is 100kbps to minimize noise. These are the prints from your code. I noticed that the peripheral_clock_rate was at 32mhz while STM32F103R8 that i'm using is at 72mhz so i tried changing that aswell to the correct clock with no success |
peripheral_clock_rate is not cpu frreuency. Arduino core support for STM32 based boards uses different clock frequencies depending on the Board Part Number. If the receive works correctly, it's not a CPU frequency issue.
I think It's too small. |
Hmm okey, then peripheral_clock_rate should be 36mhz then? Since STM32F103R8T6 is 72Mhz not 64. The receive did work yesterday, not anymore for some reason.. I saw your previous comment on another issue with 150 Ohm termination, I'll try that! |
peripheral_clock_rate is not cpu frreuency. Arduino core support for STM32 based boards uses different clock frequencies depending on the Board Part Number. You can check your board CPU freqiency using the F_CPU macro
|
Hmm, that result gave 64 Mhz. In my Platformio.ini file , the board is genericSTM32F103R8. |
If you use bluepill or blackpill in Platformio.ini, it will be 72Mhz. It has nothing to do with this issue. But everyone gets confused. |
Haha i understand why. We use a custom made PCB with STM32F103R8T6 and It's the first time with the STM32 chip family. So I thought i'd should use the genericSTM32F103R8 in the .ini file , not blackpill or bluepill .. But if i use the genericSTM32F103R8 F_CPU shows 64Mhz |
I think you can build custom boards using BluePill and BlackPill variants. However, the GPIO of the Serial object changes for the Generic board, BluePill, and BlackPill. The output destination of Serial.print differs depending on the Board Part Number. BluePill:PA9 everyone gets confused. |
I have replaced the termination resistors with 150 Ohm so that i have two terminations at the ends with a bus resistance at 75 Ohm now. No success in sending any data. |
Keep STAB length as short as possible. |
If you have a BluePill or BlackPill, you can identify the problem. Try BluePill or BlackPill. |
Sadly I don't. I can purchase one however if you think that would help ? |
There may be a problem with your custom made PCB. If it works fine with BluePill/BlackPill, then there may be a problem with your custom made PCB. BluePill/BlackPill works absolutely. |
Alright, found out the reason why reading stop worked. It was cause i was monitoring on the UART. If i only powered it on and ran with debug i could read messages. Not send however. Its quite weird actually. If dont use Hardware Serial at PA10 & PA9 Then the code gets stuck here Stepping over CANInit function with debugging results in the debug can't step over and gets stuck inside this function Digging further it goes to
And if i do use Hardware Serial at PA10 & PA9
|
Alright, If i put a delay between Serial.begin and CANInit the code doesn't hang anymore. Still getting Send Fail no matter what i do, I've got another CAN Node with the same tranciever, TJA1050 , exact same cables and length on the network that is working well, custom made PCB aswell.. |
@Toernblom have you found the solution? |
It's not a clone chip, right? Doesn't work properly with clone chips. https://hackaday.com/2020/10/22/stm32-clones-the-good-the-bad-and-the-ugly/ |
Hi, it was a fault within the PCB. I think it was some issue with different logic levels between the IC's of the MCU and CAN controller & transciever. |
@Toernblom @nopnop2002 Thanks for the reply. Is it due to powering tja1050 by 5v and stm32f103 is powered from 3.3v? |
the PB8 and PB9 pins are 5v tolerant and tja1050 should work with 3.3v devices, that's what they claim in their datasheet as tja1050 RXD is a totem pole and voltage varies from 0.7Vcc to 0.45v |
Yes. You are right. I powered the STM32F103 from USB and tried it with the 5V transceiver TJA1051. My test circuit. When CAN-BUS has a mix of 3.3V and 5V transceivers, +1V Ground Shift with Split Termination is effective |
Hi, currently using STM32F103R8T6.
CAN interface is connect like:
PB8 -> CAN_RX -> TJA1050
PB9 -> CAN_TX -> TJA1050
in void Setup I'm using:
bool ret = CANInit(CAN_500KBPS, 2); // CAN_RX mapped to PB8, CAN_TX mapped to PB9
What happens is that while debugging i notice that on this line, the while loop never ends.
Communication works ok outside this unit. Am i missing something?
The text was updated successfully, but these errors were encountered: