Skip to content

NRF52840 ACAN2518 at Normal20B receiving but not transmitting #13

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

Open
pedrodpj opened this issue Apr 1, 2021 · 3 comments
Open

NRF52840 ACAN2518 at Normal20B receiving but not transmitting #13

pedrodpj opened this issue Apr 1, 2021 · 3 comments

Comments

@pedrodpj
Copy link

pedrodpj commented Apr 1, 2021

Hi.
I'm using NRF52840 and library ACAN2717 version 1.1.10 and I'm facing some problem when trying to transmit frame data.
When running on loopback mode is ok, I can send and received frame data, but when running on Normal20B I can receive can data but when I transmit I get no error, but the data is not sent.

Se my code below:

ACAN2517Settings settings (ACAN2517Settings::OSC_20MHz, 500 * 1000) ;
settings.mRequestedMode = ACAN2517Settings::Normal20B;//InternalLoopBack;//

//----------------------------------- Append filters
ACAN2517Filters filters ;
filters.appendFrameFilter (kStandard, PID_VIN, receiveVinData);
filters.appendFrameFilter (kStandard, PID_KC_ODOMETER, receiveOdometerData);
filters.appendFrameFilter (kStandard, PID_KC_SPEED, receiveSpeedData);
filters.appendFrameFilter (kStandard, 0x777, receiveGeneric);
filters.appendFrameFilter (kStandard, 0x778, receiveGeneric);
filters.appendFrameFilter (kStandard, 0x779, receiveGeneric);

//----------------------------------- Filters ok ?
if (filters.filterStatus () != ACAN2517Filters::kFiltersOk) {
    debug.println("Error filter:  %d : %d ", filters.filterErrorIndex(), filters.filterStatus());
}
//----------------------------------- Enter configuration
const uint32_t errorCode = can.begin (settings, [] { can.isr_core () ; }, filters) ;
//----------------------------------- Config ok ?
if (errorCode == 0)
{
    debug.println("Bit Rate prescaler: %d", settings.mBitRatePrescaler);
    debug.println("Phase segment 1: %d", settings.mPhaseSegment1);
    debug.println("Phase segment 2: %d", settings.mPhaseSegment2);
    debug.println("SJW: %d", settings.mSJW);
    debug.println("Actual bit rate: %d bit/s", settings.actualBitRate());

    debug.println("Exact bit rate ? %s", settings.exactBitRate() ? "yes" : "no");
    debug.println("Sample point: %d%", settings.samplePointFromBitStart());
    debug.println("currentOperationMode: %d", can.currentOperationMode());
}
else
{
    debug.println("Configuration error %x", errorCode);
}

And now the log information:
Configure ACAN2517FD
Bit Rate prescaler: 1
Phase segment 1: 31
Phase segment 2: 8
SJW: 8
Actual bit rate: 500000 bit/s
Exact bit rate ? yes
Sample point: 80
currentOperationMode: 6
Configure ACAN2517FD done

At send operation I get:
Sent OK, with no error

Do you know if some addition settings is required to work with CAN20B at 500kbps?

@pierremolinaro
Copy link
Owner

pierremolinaro commented Apr 2, 2021 via email

@pedrodpj
Copy link
Author

pedrodpj commented Apr 5, 2021 via email

@pierremolinaro
Copy link
Owner

pierremolinaro commented Apr 5, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants